Sha256: 4e3d62347fd6d6f8116b571bb680cdd430cfd3c646112967cf2376f91b02f3dd

Contents?: true

Size: 567 Bytes

Versions: 6

Compression:

Stored size: 567 Bytes

Contents

(function($) {

  $.fn.railsSortable = function(options) {
    options = options || {};
    var settings = $.extend({}, options);

    settings.update = function(event, ui) {
      if (typeof options.update === 'function') {
        options.update(event, ui);
      }

      $.ajax({
        type: 'POST',
        url: '/sortable/reorder',
        dataType: 'json',
        contentType: 'application/json',
        data: JSON.stringify({
          rails_sortable: $(this).sortable('toArray'),
        }),
      });
    }

    this.sortable(settings);
  };
})(jQuery);

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails_sortable-1.5.0 vendor/assets/javascripts/plugin.js
rails_sortable-1.4.1 vendor/assets/javascripts/plugin.js
rails_sortable-1.4.0 vendor/assets/javascripts/plugin.js
rails_sortable-1.3.2 vendor/assets/javascripts/plugin.js
rails_sortable-1.3.1 vendor/assets/javascripts/plugin.js
rails_sortable-1.3.0 vendor/assets/javascripts/plugin.js