Sha256: 0ce689fb10bad7af4a3f0171905202f9fe444819ac9765eb47d1e16e3eb6413a

Contents?: true

Size: 812 Bytes

Versions: 11

Compression:

Stored size: 812 Bytes

Contents

$ ->
  window.setInputDateTime = (field) ->
    date = $("##{field}_date").val()
    time = $("##{field}_time").val()
    $('#' + field).val("#{date} #{time}")

  window.initPickers = ->
    $('input.datepicker')
      .datepicker({format: 'dd.mm.yyyy', language: 'ru', autoclose: true})
      .on 'changeDate', (e) ->
        setInputDateTime($(e.target).data('target'))
      .on 'show', (e) ->
        if ($(document).width() - $(e.target).offset().left) < 200
          $('.datepicker.dropdown-menu:visible').css({left: "#{$(document).width() - 255}px"}).addClass('right_picker')
          
    $('input.timepicker').timepicker({showMeridian: false}).bind 'hidden', (e) ->
      setInputDateTime($(e.target).data('target'))

  initPickers()

  $('.simple_form').bind "nested:fieldAdded", =>
    initPickers()

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ab_admin-0.3.6 app/assets/javascripts/ab_admin/inputs/datetime_input.js.coffee
ab_admin-0.3.5 app/assets/javascripts/ab_admin/inputs/datetime_input.js.coffee
ab_admin-0.3.4 app/assets/javascripts/ab_admin/inputs/datetime_input.js.coffee
ab_admin-0.3.3 app/assets/javascripts/ab_admin/inputs/datetime_input.js.coffee
ab_admin-0.3.2 app/assets/javascripts/ab_admin/inputs/datetime_input.js.coffee
ab_admin-0.3.1 app/assets/javascripts/ab_admin/inputs/datetime_input.js.coffee
ab_admin-0.3.0 app/assets/javascripts/ab_admin/inputs/datetime_input.js.coffee
ab_admin-0.2.3 app/assets/javascripts/ab_admin/inputs/datetime_input.js.coffee
ab_admin-0.2.2 app/assets/javascripts/ab_admin/inputs/datetime_input.js.coffee
ab_admin-0.2.1 app/assets/javascripts/ab_admin/inputs/datetime_input.js.coffee
ab_admin-0.2.0 app/assets/javascripts/ab_admin/inputs/datetime_input.js.coffee