Sha256: 4a2c4238fcb1c06ced715c95795b3c1932323c7e9fac560bba49693b24091cb4

Contents?: true

Size: 1.33 KB

Versions: 9

Compression:

Stored size: 1.33 KB

Contents

$(document).on 'ready page:load', ->
  $("input.datepicker").each (i) ->
    defOpts = {
    altFormat: "yy-mm-dd"
    altField: $(this).next()
    changeYear: true
    changeMonth: true}
    setDatePickerOptions( this, defOpts )

$(document).on 'ready page:load', ->
  $("input.datetimepicker").each (i) ->
    defOpts = {altField: $(this).next()
    altFieldTimeOnly: false
    altFormat: "yy-mm-dd"
    altTimeFormat: "HH:mm"}
    setPickerOptions( this, defOpts )

$(document).on 'ready page:load', ->
  $("input.timepicker").each (i) ->
    defOpts = {timeOnly: true
    altField: $(this).next()
    altFieldTimeOnly: false
    defaultValue: this.value}
    setPickerOptions( this, defOpts )
    
      
setPickerOptions = (input, defOpts) ->
  userOpts = $(input).data()
  allOpts = $.extend({}, defOpts, userOpts)
  $(input).datetimepicker(allOpts)

setDatePickerOptions = (input, defOpts) ->
  userOpts = $(input).data()
  allOpts = $.extend({}, defOpts, userOpts)
  $(input).datepicker(allOpts)


#dataObj = input.data()
# $.each(dataObj, function (k,v) {
#     console.log(k+"="+v)
# });


# $(document).on 'ready page:load', ->
#   $("input.timepicker").each (i) ->
#     $(this).timepicker
#       altField: $(this).next()
#       hourGrid: 6
#       minuteGrid: 10
#       secondGrid: 10
#       timeFormat: this.getAttribute("data-time-format")

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hot_date_rails-1.5.2 app/assets/javascripts/hot_date_rails/hot_date_rails.js.coffee
hot_date_rails-1.4.1 app/assets/javascripts/hot_date_rails/hot_date_rails.js.coffee
hot_date_rails-1.4.0 app/assets/javascripts/hot_date_rails/hot_date_rails.js.coffee
hot_date_rails-1.3.3 app/assets/javascripts/hot_date_rails/hot_date_rails.js.coffee
hot_date_rails-1.3.2 app/assets/javascripts/hot_date_rails/hot_date_rails.js.coffee
hot_date_rails-1.3.1 app/assets/javascripts/hot_date_rails/hot_date_rails.js.coffee
hot_date_rails-1.3.0 app/assets/javascripts/hot_date_rails/hot_date_rails.js.coffee
hot_date_rails-1.2.0 app/assets/javascripts/hot_date_rails/hot_date_rails.js.coffee
hot_date_rails-1.0.0 app/assets/javascripts/hot_date_rails/hot_date_rails.js.coffee