Skip to content

Instantly share code, notes, and snippets.

@e1senh0rn
Created March 7, 2012 09:14
Show Gist options
  • Select an option

  • Save e1senh0rn/1992104 to your computer and use it in GitHub Desktop.

Select an option

Save e1senh0rn/1992104 to your computer and use it in GitHub Desktop.
(function() {
var AdminVacationSorter;
AdminVacationSorter = (function() {
function AdminVacationSorter(parent_selector, children_selector) {
var options;
this.parent_selector = parent_selector;
this.children_selector = children_selector;
options = {
items: this.children_selector,
axis: 'y',
containment: 'parent',
cursor: 'move',
update: this.update_handler,
helper: this.helper_handler
};
this.sortable = $(parent_selector).sortable(options).disableSelection();
}
AdminVacationSorter.prototype.update_handler = function(event, ui) {
return console.log(ui);
};
AdminVacationSorter.prototype.helper_handler = function(event, ui) {
var clone;
clone = ui.clone;
clone.children().each(function(i, element) {
return $(element).width(ui.children().eq(i).width());
});
return clone;
};
return AdminVacationSorter;
})();
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment