From 24cc69876fe99bbab6fc3cb3f39c9e838d033703 Mon Sep 17 00:00:00 2001 From: hukl Date: Wed, 2 Sep 2009 21:18:01 +0200 Subject: more refactoring - self.bite(table) --- public/javascripts/admin_interface.js | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'public') diff --git a/public/javascripts/admin_interface.js b/public/javascripts/admin_interface.js index d83274d..4084983 100644 --- a/public/javascripts/admin_interface.js +++ b/public/javascripts/admin_interface.js @@ -127,6 +127,7 @@ image_interface = { image_interface.connect_browser_and_box(); image_interface.set_droppable_behavior(); image_interface.bind_image_browser_toggle(); + image_interface.update_current_images(); }, @@ -150,28 +151,14 @@ image_interface = { $("#image_browser ul li").draggable({ connectToSortable : 'ul#image_box', helper : 'clone', - revert : 'invalid', - start : function(event, ui) { - image_interface.current_images = $("ul#image_box").sortable( - "serialize", - {attribute : "rel"} - ) - }, - stop : function() { - - } + revert : 'invalid' }); }, initialize_sortable_image_box : function() { + $("ul#image_box").sortable({ revert : true, - start : function(event, ui) { - image_interface.current_images = $("ul#image_box").sortable( - "serialize", - {attribute : "rel"} - ) - }, stop : function(event, ui) { images = $("ul#image_box").sortable("serialize", {attribute : "rel"}); @@ -181,7 +168,9 @@ image_interface = { url : "/pages/" + $("ul#image_box").attr("rel") + "/sort_images", dataType : "json", data : images + "&_method=put", - success : function() {} + success : function() { + image_interface.update_current_images(); + } }); } } @@ -201,6 +190,13 @@ image_interface = { return false; }); + }, + + update_current_images : function() { + image_interface.current_images = $("ul#image_box").sortable( + "serialize", + {attribute : "rel"} + ); } } -- cgit v1.3