Sha256: dfa9d5629bdd2dc853e4bad1da379a15ef2ffda0df9cd261a1b22c778ae937b3
Contents?: true
Size: 938 Bytes
Versions: 9
Compression:
Stored size: 938 Bytes
Contents
class CalendarApplication calendarElements = 'ul.dates': CalendarDatesController 'ul.event_details': CalendarEventsController @initialize = (options = {}) -> for element, controller of calendarElements for el in $(element) new controller($(el)) if options.history @initializeHistory(options.basePath) @initializeHistory = (basePath) -> CalendarDate.all().map( (date) -> date.element.bind('click', (event) -> window?.history?.pushState( { dateObjectId: date.id }, null, "#{basePath}/#{date.toPath()}" ) ) ) window?.onpopstate = (event) -> if event.state?.dateObjectId? date = CalendarDate.find(event.state.dateObjectId) date.trigger('activate') CalendarDate.deactivateAllDates() date.updateAttributes(active: true) window.CalendarApplication = CalendarApplication
Version data entries
9 entries across 9 versions & 1 rubygems