app/assets/javascripts/time_machine/datepicker.coffee in time_machine-0.0.1 vs app/assets/javascripts/time_machine/datepicker.coffee in time_machine-0.0.2

- old
+ new

@@ -1,10 +1,21 @@ jQuery -> + redirect = (date) -> window.location.href = "/time_machine/#{date}" + # initialize date picker $('#time-machine-date').Zebra_DatePicker always_show_clear: false lang_clear_date: '' - onSelect: (date) -> window.location.href = "/time_machine/#{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