Sha256: 57bd5fa657bcffbdeb5479ba379ef1a81e25adc3a125f44e50fbdfdf2a4c75ed

Contents?: true

Size: 726 Bytes

Versions: 1

Compression:

Stored size: 726 Bytes

Contents

jQuery ->
  redirect = (date) -> window.location.href = "/time_machine/#{date}"

  # initialize date picker
  $('#time-machine-date').Zebra_DatePicker
    always_show_clear: false
    lang_clear_date: ''
    readonly_element: false
    onSelect: (date) -> redirect date

  $(document).on 'keydown', '#time-machine-date', (ev) ->
    if ev.keyCode == 13
      date = $('#time-machine-date').val()
      redirect date if ev.keyCode == 13 && date.trim().length > 0
      false

  $(document).on 'mouseup', '#time-machine-date', (ev) -> $(@).select()

  # toggle expanded/collapsed satte
  $(document).on 'click', '#time-machine a.toggle', ->
    $('#time-machine').toggleClass('collapsed')
    false

  $('#time-machine').show()

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
time_machine-0.0.2 app/assets/javascripts/time_machine/datepicker.coffee