diff options
| author | hukl <contact@smyck.org> | 2009-09-02 21:18:01 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-09-02 21:18:01 +0200 |
| commit | 24cc69876fe99bbab6fc3cb3f39c9e838d033703 (patch) | |
| tree | dd9e0f300b8afabfeab869a22f955a90130ccaec /public | |
| parent | f76b1657246898055d7c991ec0ca9f5b337b60ef (diff) | |
more refactoring - self.bite(table)
Diffstat (limited to 'public')
| -rw-r--r-- | public/javascripts/admin_interface.js | 30 |
1 files changed, 13 insertions, 17 deletions
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 = { | |||
| 127 | image_interface.connect_browser_and_box(); | 127 | image_interface.connect_browser_and_box(); |
| 128 | image_interface.set_droppable_behavior(); | 128 | image_interface.set_droppable_behavior(); |
| 129 | image_interface.bind_image_browser_toggle(); | 129 | image_interface.bind_image_browser_toggle(); |
| 130 | image_interface.update_current_images(); | ||
| 130 | }, | 131 | }, |
| 131 | 132 | ||
| 132 | 133 | ||
| @@ -150,28 +151,14 @@ image_interface = { | |||
| 150 | $("#image_browser ul li").draggable({ | 151 | $("#image_browser ul li").draggable({ |
| 151 | connectToSortable : 'ul#image_box', | 152 | connectToSortable : 'ul#image_box', |
| 152 | helper : 'clone', | 153 | helper : 'clone', |
| 153 | revert : 'invalid', | 154 | revert : 'invalid' |
| 154 | start : function(event, ui) { | ||
| 155 | image_interface.current_images = $("ul#image_box").sortable( | ||
| 156 | "serialize", | ||
| 157 | {attribute : "rel"} | ||
| 158 | ) | ||
| 159 | }, | ||
| 160 | stop : function() { | ||
| 161 | |||
| 162 | } | ||
| 163 | }); | 155 | }); |
| 164 | }, | 156 | }, |
| 165 | 157 | ||
| 166 | initialize_sortable_image_box : function() { | 158 | initialize_sortable_image_box : function() { |
| 159 | |||
| 167 | $("ul#image_box").sortable({ | 160 | $("ul#image_box").sortable({ |
| 168 | revert : true, | 161 | revert : true, |
| 169 | start : function(event, ui) { | ||
| 170 | image_interface.current_images = $("ul#image_box").sortable( | ||
| 171 | "serialize", | ||
| 172 | {attribute : "rel"} | ||
| 173 | ) | ||
| 174 | }, | ||
| 175 | stop : function(event, ui) { | 162 | stop : function(event, ui) { |
| 176 | images = $("ul#image_box").sortable("serialize", {attribute : "rel"}); | 163 | images = $("ul#image_box").sortable("serialize", {attribute : "rel"}); |
| 177 | 164 | ||
| @@ -181,7 +168,9 @@ image_interface = { | |||
| 181 | url : "/pages/" + $("ul#image_box").attr("rel") + "/sort_images", | 168 | url : "/pages/" + $("ul#image_box").attr("rel") + "/sort_images", |
| 182 | dataType : "json", | 169 | dataType : "json", |
| 183 | data : images + "&_method=put", | 170 | data : images + "&_method=put", |
| 184 | success : function() {} | 171 | success : function() { |
| 172 | image_interface.update_current_images(); | ||
| 173 | } | ||
| 185 | }); | 174 | }); |
| 186 | } | 175 | } |
| 187 | } | 176 | } |
| @@ -201,6 +190,13 @@ image_interface = { | |||
| 201 | 190 | ||
| 202 | return false; | 191 | return false; |
| 203 | }); | 192 | }); |
| 193 | }, | ||
| 194 | |||
| 195 | update_current_images : function() { | ||
| 196 | image_interface.current_images = $("ul#image_box").sortable( | ||
| 197 | "serialize", | ||
| 198 | {attribute : "rel"} | ||
| 199 | ); | ||
| 204 | } | 200 | } |
| 205 | } | 201 | } |
| 206 | 202 | ||
