diff options
| author | hukl <contact@smyck.org> | 2009-09-02 19:37:24 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-09-02 19:37:24 +0200 |
| commit | 3a71919db79ee00f9898b2c07737740b3420dd25 (patch) | |
| tree | 3087d39583e890c6dfc442b4d78b6aefd48d8af8 /public/javascripts | |
| parent | 4c4bdfb35d23bc1113e669ff22f2d4e074529707 (diff) | |
corresponding css and js changes
Diffstat (limited to 'public/javascripts')
| -rw-r--r-- | public/javascripts/admin_interface.js | 70 |
1 files changed, 41 insertions, 29 deletions
diff --git a/public/javascripts/admin_interface.js b/public/javascripts/admin_interface.js index a78342e..88a543b 100644 --- a/public/javascripts/admin_interface.js +++ b/public/javascripts/admin_interface.js | |||
| @@ -3,7 +3,7 @@ $(document).ready(function () { | |||
| 3 | menu_items.initialize_search(); | 3 | menu_items.initialize_search(); |
| 4 | meta_data.initialize(); | 4 | meta_data.initialize(); |
| 5 | menu_item_sorter.initialize(); | 5 | menu_item_sorter.initialize(); |
| 6 | 6 | image_interface.initialize(); | |
| 7 | 7 | ||
| 8 | jQuery.ajaxSetup({ | 8 | jQuery.ajaxSetup({ |
| 9 | 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} | 9 | 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} |
| @@ -27,8 +27,7 @@ meta_data = { | |||
| 27 | $("#metadata").slideToggle(1200); | 27 | $("#metadata").slideToggle(1200); |
| 28 | 28 | ||
| 29 | if ($("#button").attr("class") == "unselected") { | 29 | if ($("#button").attr("class") == "unselected") { |
| 30 | $("#button").attr("class", "selected"); | 30 | $("#button").attr("class", "selected"); |
| 31 | image_interface.initialize(); | ||
| 32 | } | 31 | } |
| 33 | else { | 32 | else { |
| 34 | $("#button").attr("class", "unselected"); | 33 | $("#button").attr("class", "unselected"); |
| @@ -118,17 +117,32 @@ image_interface = { | |||
| 118 | current_images : "", | 117 | current_images : "", |
| 119 | 118 | ||
| 120 | initialize : function() { | 119 | initialize : function() { |
| 121 | $("#image_browser_toggle").bind("click", function(){ | 120 | |
| 122 | if ($("#image_browser_toggle").attr("class") == "unselected") { | 121 | $("#image_browser").hide(); |
| 123 | $("#image_browser_toggle").attr("class", "selected"); | 122 | |
| 124 | } | 123 | image_interface.bind_image_browser_toggle(); |
| 125 | else { | 124 | image_interface.initialize_sortable_image_box(); |
| 126 | $("#image_browser_toggle").attr("class", "unselected"); | 125 | image_interface.connect_browser_and_box(); |
| 126 | }, | ||
| 127 | |||
| 128 | connect_browser_and_box : function() { | ||
| 129 | $("#image_browser ul li").draggable({ | ||
| 130 | connectToSortable : 'ul#image_box', | ||
| 131 | helper : 'clone', | ||
| 132 | revert : 'invalid', | ||
| 133 | start : function(event, ui) { | ||
| 134 | image_interface.current_images = $("ul#image_box").sortable( | ||
| 135 | "serialize", | ||
| 136 | {attribute : "rel"} | ||
| 137 | ) | ||
| 138 | }, | ||
| 139 | stop : function() { | ||
| 140 | |||
| 127 | } | 141 | } |
| 128 | |||
| 129 | return false | ||
| 130 | }); | 142 | }); |
| 131 | 143 | }, | |
| 144 | |||
| 145 | initialize_sortable_image_box : function() { | ||
| 132 | $("ul#image_box").sortable({ | 146 | $("ul#image_box").sortable({ |
| 133 | revert : true, | 147 | revert : true, |
| 134 | start : function(event, ui) { | 148 | start : function(event, ui) { |
| @@ -139,7 +153,7 @@ image_interface = { | |||
| 139 | }, | 153 | }, |
| 140 | stop : function(event, ui) { | 154 | stop : function(event, ui) { |
| 141 | images = $("ul#image_box").sortable("serialize", {attribute : "rel"}); | 155 | images = $("ul#image_box").sortable("serialize", {attribute : "rel"}); |
| 142 | 156 | ||
| 143 | if (images != image_interface.current_images) { | 157 | if (images != image_interface.current_images) { |
| 144 | $.ajax({ | 158 | $.ajax({ |
| 145 | type : "POST", | 159 | type : "POST", |
| @@ -155,7 +169,7 @@ image_interface = { | |||
| 155 | $("ul#image_box").droppable({ | 169 | $("ul#image_box").droppable({ |
| 156 | out : function(event, ui) { | 170 | out : function(event, ui) { |
| 157 | $(ui.draggable).fadeTo("fast", 0.4); | 171 | $(ui.draggable).fadeTo("fast", 0.4); |
| 158 | 172 | ||
| 159 | $(ui.draggable).bind("mouseup", function() { | 173 | $(ui.draggable).bind("mouseup", function() { |
| 160 | $(this).remove(); | 174 | $(this).remove(); |
| 161 | }); | 175 | }); |
| @@ -165,23 +179,21 @@ image_interface = { | |||
| 165 | $(ui.draggable).unbind("mouseup"); | 179 | $(ui.draggable).unbind("mouseup"); |
| 166 | } | 180 | } |
| 167 | }); | 181 | }); |
| 168 | 182 | }, | |
| 169 | $("div#asset_toolbox ul li").draggable({ | 183 | |
| 170 | connectToSortable : 'ul#image_box', | 184 | bind_image_browser_toggle : function() { |
| 171 | helper : 'clone', | 185 | $("#image_browser_toggle").bind("click", function(){ |
| 172 | revert : 'invalid', | 186 | if ($("#image_browser_toggle").attr("class") == "unselected") { |
| 173 | start : function(event, ui) { | 187 | $("#image_browser_toggle").attr("class", "selected"); |
| 174 | image_interface.current_images = $("ul#image_box").sortable( | 188 | $("#image_browser").show(); |
| 175 | "serialize", | ||
| 176 | {attribute : "rel"} | ||
| 177 | ) | ||
| 178 | }, | ||
| 179 | stop : function() { | ||
| 180 | |||
| 181 | } | 189 | } |
| 190 | else { | ||
| 191 | $("#image_browser_toggle").attr("class", "unselected"); | ||
| 192 | $("#image_browser").hide(); | ||
| 193 | } | ||
| 194 | |||
| 195 | return false; | ||
| 182 | }); | 196 | }); |
| 183 | |||
| 184 | $("ul, li").disableSelection(); | ||
| 185 | } | 197 | } |
| 186 | } | 198 | } |
| 187 | 199 | ||
