Sha256: 4eda1e530d7386a89458a20e05855dae46a019dd9fb057bdced0e2e7326ad63e

Contents?: true

Size: 952 Bytes

Versions: 7

Compression:

Stored size: 952 Bytes

Contents

# http://eonasdan.github.io/bootstrap-datetimepicker/Options/

initialize = (target) ->
  $(target || document).find('input.effective_time_picker:not(.initialized)').each (i, element) ->
    element = $(element)
    options = element.data('input-js-options') || {}

    element.addClass('initialized').datetimepicker(options)
    element.trigger('dp.end_date_initialized') if (element.attr('name') || '').indexOf('[end_') != -1

$ -> initialize()
$(document).on 'page:change', -> initialize()
$(document).on 'turbolinks:load', -> initialize()
$(document).on 'turbolinks:render', -> initialize()
$(document).on 'cocoon:after-insert', -> initialize()
$(document).on 'effective-form-inputs:initialize', (event) -> initialize(event.currentTarget)

$(document).on 'turbolinks:before-cache', ->
  $('input.effective_time_picker.initialized').each (i, element) ->
    $input = $(element)
    $input.datetimepicker('destroy') if $input.data('datetimepicker')

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
effective_form_inputs-1.2.3 app/assets/javascripts/effective_time_picker/initialize.js.coffee
effective_form_inputs-1.2.2 app/assets/javascripts/effective_time_picker/initialize.js.coffee
effective_form_inputs-1.2.1 app/assets/javascripts/effective_time_picker/initialize.js.coffee
effective_form_inputs-1.2.0 app/assets/javascripts/effective_time_picker/initialize.js.coffee
effective_form_inputs-1.1.15 app/assets/javascripts/effective_time_picker/initialize.js.coffee
effective_form_inputs-1.1.14 app/assets/javascripts/effective_time_picker/initialize.js.coffee
effective_form_inputs-1.1.13 app/assets/javascripts/effective_time_picker/initialize.js.coffee