Sha256: 1355ccf6e2407bde874b58500b4e2efb91b53d23fb9e401a0d6da77cd1cf68b4

Contents?: true

Size: 982 Bytes

Versions: 19

Compression:

Stored size: 982 Bytes

Contents

@unlazy_datepickers = (jRoot) ->
  jRoot.find('input.datepicker.lazy').removeClass('lazy').length

@bind_datepickers = (jRoot) ->
  jRoot.find('input.datepicker:not(.lazy, .hasDatepicker)').each( ->
    jThis = $ @
    opts =
      'showAnim'       : ''
      'showOn'         : 'both'
      'buttonImage'    : '/images/forms/datepicker__icon.png'  # TODO forwarding assets path
      'buttonImageOnly': true
      'changeMonth'    : true
      'changeYear'     : true
      'onClose'        : (dateText, inst) -> $(inst.input).change().focusout()
    opts[_.camelize(k)] = d  for k, d of jThis.data()
    jThis.datepicker opts
  ).length

$.fn.orig_datepicker = $.fn.datepicker

$.fn.datepicker = ->
  return @  unless @length
  @data('changed', true)  if arguments.length and arguments[0] is 'setDate'
  $.fn.orig_datepicker.apply @, arguments



$ ->

  $('body').on 'keyup keydown', 'input.datepicker.hasDatepicker', ->
    $(@).datepicker 'hide'

  bind_datepickers $('body')

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
ultimate-base-0.5.0.0 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.4.1.0 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.4.0.1 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.4.0.0 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.3.5.0 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.3.4.0 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.3.3.0 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.3.2.1 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.3.2 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.3.1.1 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.3.1 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.3.0 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.3.0.alpha app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.2.4 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.2.3.2 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.2.3 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.2.2 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.2.1 app/assets/javascripts/ultimate/improves/datepicker.js.coffee
ultimate-base-0.2.0 app/assets/javascripts/ultimate/improves/datepicker.js.coffee