Sha256: 8d0b7b9033a06bbd7172852730c906233422c8c62958d9424f30ae7b3299c138

Contents?: true

Size: 1.82 KB

Versions: 4

Compression:

Stored size: 1.82 KB

Contents

<%# encoding: utf-8 %>
<% I18n.available_locales.each { |locale| Rails.root.glob("config/locales/#{locale}.*").each { |path| depend_on path.to_s } } %>
<%= ActiveScaffold::Bridges[:date_picker].localization %>
Object.getPrototypeOf(jQuery.datepicker)._attachDatepicker_without_inlineSettings = Object.getPrototypeOf(jQuery.datepicker)._attachDatepicker;
jQuery.extend(Object.getPrototypeOf(jQuery.datepicker), {
  _attachDatepicker: function(target, settings) {
    var inlineSettings = {}, $target = jQuery(target);
    for (var attrName in this._defaults) {
      if(this._defaults.hasOwnProperty(attrName)){
        var attrValue = $target.data(attrName.toLowerCase());
        if (attrValue !== undefined) {
          try {
            inlineSettings[attrName] = eval(attrValue);
          } catch (err) {
            inlineSettings[attrName] = attrValue;
          }
        }
      }
    }
    this._attachDatepicker_without_inlineSettings(target, jQuery.extend({}, settings || {}, inlineSettings));
  }
});
jQuery(document).on("focus", "input.date_picker", function(){
  var date_picker = jQuery(this);
  if (typeof(date_picker.datepicker) == 'function') {
    if (!date_picker.hasClass('hasDatepicker')) {
      date_picker.datepicker();
      date_picker.trigger('focus');
    }
  }
  return true;
});

jQuery(document).on("focus", "input.datetime_picker", function(){
  var date_picker = jQuery(this);
  if (typeof(date_picker.datetimepicker) == 'function') {
    if (!date_picker.hasClass('hasDatepicker')) {
      date_picker.datetimepicker();
      date_picker.trigger('focus');
    }
  }
  return true;
});

jQuery(document).on('change', 'input.datetime_picker', function(e) {
  var $this = $(this);
  if ($this.data('first-event')) $this.removeData('first-event');
  else {
    $this.data('first-event', true);
    e.stopImmediatePropagation();
  }
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
active_scaffold-4.0.0 app/assets/javascripts/jquery/date_picker_bridge.js.erb
active_scaffold-4.0.0.rc3 app/assets/javascripts/jquery/date_picker_bridge.js.erb
active_scaffold-4.0.0.rc2 app/assets/javascripts/jquery/date_picker_bridge.js.erb
active_scaffold-4.0.0.rc1 app/assets/javascripts/jquery/date_picker_bridge.js.erb