Sha256: 16309bb4060b0922925a57bc6ffe9f3b52099ef938f242f00a6c1951d1fb3f37

Contents?: true

Size: 1002 Bytes

Versions: 10

Compression:

Stored size: 1002 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)

    name = element.attr('name') || ''
    if name.indexOf('end_') != -1 || name.indexOf('_end') != -1
      element.trigger('dp.end_date_initialized')

$ -> 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

10 entries across 10 versions & 1 rubygems

Version Path
effective_form_inputs-1.5.0 app/assets/javascripts/effective_time_picker/initialize.js.coffee
effective_form_inputs-1.4.1 app/assets/javascripts/effective_time_picker/initialize.js.coffee
effective_form_inputs-1.4.0 app/assets/javascripts/effective_time_picker/initialize.js.coffee
effective_form_inputs-1.3.0 app/assets/javascripts/effective_time_picker/initialize.js.coffee
effective_form_inputs-1.2.9 app/assets/javascripts/effective_time_picker/initialize.js.coffee
effective_form_inputs-1.2.8 app/assets/javascripts/effective_time_picker/initialize.js.coffee
effective_form_inputs-1.2.7 app/assets/javascripts/effective_time_picker/initialize.js.coffee
effective_form_inputs-1.2.6 app/assets/javascripts/effective_time_picker/initialize.js.coffee
effective_form_inputs-1.2.5 app/assets/javascripts/effective_time_picker/initialize.js.coffee
effective_form_inputs-1.2.4 app/assets/javascripts/effective_time_picker/initialize.js.coffee