Sha256: 228917ea1e3147f7ddb801f03b8d0bece412a2346588ae7e6bde85e57c1dbf85

Contents?: true

Size: 839 Bytes

Versions: 4

Compression:

Stored size: 839 Bytes

Contents

var fixHelper;

fixHelper = function(e, ui) {
  ui.children().each(function() {
    return $(this).width($(this).width());
  });
  return ui;
};

function initSortables() {
  if ($(".sortables").length > 0) {
    $(".sortables").sortable({
      items: ".sortable",
      handle: ".handle",
      helper: fixHelper,
      forceHelperSize: true,
      start: function(e, ui) {
        ui.placeholder.height(ui.item.height());
      },
      update: function(e, ui) {
        var elem = ui.item
        return $.ajax({
          type: 'POST',
          url: $(this).data("rel"),
          dataType: 'json',
          data: $(this).sortable("serialize"),
          success: function() {
            $(elem).effect("highlight", {}, 1000);
          }
        });
      }
    }).disableSelection();
  }
}

$(function() {
  initSortables();
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta7 app/assets/javascripts/renalware/sortable.js
renalware-core-2.0.0.pre.beta6 app/assets/javascripts/renalware/sortable.js
renalware-core-2.0.0.pre.beta5 app/assets/javascripts/renalware/sortable.js
renalware-core-2.0.0.pre.beta4 app/assets/javascripts/renalware/sortable.js