new code logic for saving tree.. should work fine even if the node positions fail
This commit is contained in:
1 parent
3db075b9d2
commit
b1867dd47a
4 files changed
+28
-22
No files matched your search
@@ -321,13 +321,16 @@ $(function() {
|
||||
disableNesting: 'no-nest',
|
||||
update: function(event, ui) {
|
||||
var position = null;
|
||||
// if($(ui.item).closest('ol').hasClass('item-groups')) {
|
||||
// position = $(ui.item).index() - 1;
|
||||
// } else {
|
||||
// position = $(ui.item).index();
|
||||
// };
|
||||
position = $(ui.item).index();
|
||||
$.post("<%= Rails.application.routes.url_helpers.update_position_admin_items_path %>", { id: ui.item.attr('id'), parent_id: (ui.item.parent().closest('li').attr('id') || ui.item.parent().closest('ol').attr('id')), position: position } );
|
||||
if($(ui.item).closest('ol').hasClass('item-groups')) {
|
||||
position = $(ui.item).index() - 1;
|
||||
} else {
|
||||
position = $(ui.item).index();
|
||||
};
|
||||
var next_sibling = $(ui.item).next(),
|
||||
next_sibling_id = null;
|
||||
if( next_sibling )
|
||||
next_sibling_id = next_sibling.attr("id");
|
||||
$.post("<%= Rails.application.routes.url_helpers.update_position_admin_items_path %>", { id: ui.item.attr('id'), parent_id: (ui.item.parent().closest('li').attr('id') || ui.item.parent().closest('ol').attr('id')), position: position, "next_sibling_id" : next_sibling_id } );
|
||||
}
|
||||
});
|
||||
$(".sortable").delegate(".brand, .delete", clickEvent, function(e){
|
||||
|
||||
Reference in new issue
Block a user