Sha256: 3d726012b15268df2d4c13de781666aef9b6c91c36086a3aec25ba0b3e11eb1f

Contents?: true

Size: 914 Bytes

Versions: 12

Compression:

Stored size: 914 Bytes

Contents

class CalendarDatesController extends Spine.Module
  constructor: (element) ->
    @element = element
    @initializeDates()

  initializeDates: () ->
    for el in @element.find('.date')
      date = CalendarDate.create(
        element: $(el)
        date: $(el).data('date')
        active: false
      )
      @initializeEventSelect(date)

  initializeEventSelect: (date) ->
    date.element.bind('click', () ->
      date.trigger('activate')
      CalendarDate.deactivateAllDates()
      date.updateAttributes(active: true)
    )
    date.bind('activate', (date) ->
      CalendarEvent.deactivateAllEvents()
      CalendarEvent.activateAllEventsOn(date.date)
    )
    date.bind('change', (date) ->
      if date.active == true
        date.element.addClass('selected')
      if date.active == false
        date.element.removeClass('selected')
    )

window.CalendarDatesController = CalendarDatesController

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
event_cal-2.0.2 vendor/assets/javascripts/controllers/calendarDatesController.js.coffee
event_cal-2.0.1 vendor/assets/javascripts/controllers/calendarDatesController.js.coffee
event_cal-2.0.0 vendor/assets/javascripts/controllers/calendarDatesController.js.coffee
event_cal-1.3.0 vendor/assets/javascripts/controllers/calendarDatesController.js.coffee
event_cal-1.2.5 vendor/assets/javascripts/controllers/calendarDatesController.js.coffee
event_cal-1.2.4 vendor/assets/javascripts/controllers/calendarDatesController.js.coffee
event_cal-1.2.3 vendor/assets/javascripts/controllers/calendarDatesController.js.coffee
event_cal-1.2.2 vendor/assets/javascripts/controllers/calendarDatesController.js.coffee
event_cal-1.2.1 vendor/assets/javascripts/controllers/calendarDatesController.js.coffee
event_cal-1.2 vendor/assets/javascripts/controllers/calendarDatesController.js.coffee
event_cal-1.1 vendor/assets/javascripts/controllers/calendarDatesController.js.coffee
event_cal-1.0 vendor/assets/javascripts/controllers/calendarDatesController.js.coffee