Sha256: 62a16780b24950d732c57808d8e426fe4e8426c785b2f416648bea7a6e048430

Contents?: true

Size: 1.56 KB

Versions: 37

Compression:

Stored size: 1.56 KB

Contents

/*
 * RailsAdmin date/time picker @VERSION
 *
 * License
 *
 * http://www.railsadmin.org
 *
 * Depends:
 *   jquery.ui.core.js
 *   jquery.ui.widget.js
 *   jquery.ui.datepicker.js
 *   jquery.ui.timepicker.js (http://plugins.jquery.com/project/timepicker-by-fgelinas)
 */
(function($) {

  $.widget("ra.datetimepicker", {
    options: {
      showDate: true,
      showTime: true,
      datepicker: {},
      timepicker: {}
    },

    _create: function() {
      var widget = this;
      this.element.hide();

      if (this.options.showTime) {
        this.timepicker = $('<input class="TIMEPICKER" type="text" value="' + this.options.timepicker.value + '" />');

        this.timepicker.css("width", "60px");

        this.timepicker.insertAfter(this.element);

        this.timepicker.bind("change", function() { widget._onChange(); });

        this.timepicker.timepicker(this.options.timepicker);
      }

      if (this.options.showDate) {
        this.datepicker = $('<input type="text" value="' + this.options.datepicker.value + '" />');

        this.datepicker.css("margin-right", "10px");

        this.datepicker.insertAfter(this.element);

        this.datepicker.bind("change", function() { widget._onChange(); });

        this.datepicker.datepicker(this.options.datepicker);
      }
    },

    _onChange: function() {
      var value = [];

      if (this.options.showDate) {
        value.push(this.datepicker.val());
      }

      if (this.options.showTime) {
        value.push(this.timepicker.val());
      }

      this.element.val(value.join(" "));
    }
  });
})(jQuery);

Version data entries

37 entries across 37 versions & 5 rubygems

Version Path
rails_admin-0.6.7 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.6.6 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.6.5 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.6.4 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.6.3 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.6.2 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.6.1 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.6.0 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.5.0 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.4.9 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.4.8 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.4.7 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.4.6 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.4.5 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.4.4 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-lbgraham-0.4.2 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.4.3 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.4.2 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.4.1 app/assets/javascripts/rails_admin/ra.datetimepicker.js
rails_admin-0.4.0 app/assets/javascripts/rails_admin/ra.datetimepicker.js