diff options
| author | hukl <contact@smyck.org> | 2009-09-02 19:51:12 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-09-02 19:51:12 +0200 |
| commit | f76b1657246898055d7c991ec0ca9f5b337b60ef (patch) | |
| tree | e3427b07c2534b06b84a02b8ab437b171a523aeb /public/javascripts | |
| parent | 3a71919db79ee00f9898b2c07737740b3420dd25 (diff) | |
wow - jquery sucks from time to time. it works now entirely as expected but I don't know why it didn't before *sigh*
Diffstat (limited to 'public/javascripts')
| -rw-r--r-- | public/javascripts/admin_interface.js | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/public/javascripts/admin_interface.js b/public/javascripts/admin_interface.js index 88a543b..d83274d 100644 --- a/public/javascripts/admin_interface.js +++ b/public/javascripts/admin_interface.js | |||
| @@ -3,7 +3,6 @@ $(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 | image_interface.initialize(); | ||
| 7 | 6 | ||
| 8 | jQuery.ajaxSetup({ | 7 | jQuery.ajaxSetup({ |
| 9 | 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} | 8 | 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} |
| @@ -24,13 +23,18 @@ meta_data = { | |||
| 24 | $("#metadata").hide(); | 23 | $("#metadata").hide(); |
| 25 | 24 | ||
| 26 | $("#button").click(function () { | 25 | $("#button").click(function () { |
| 26 | |||
| 27 | $("#metadata").slideToggle(1200); | 27 | $("#metadata").slideToggle(1200); |
| 28 | image_interface.initialize(); | ||
| 28 | 29 | ||
| 29 | if ($("#button").attr("class") == "unselected") { | 30 | if ($("#button").attr("class") == "unselected") { |
| 30 | $("#button").attr("class", "selected"); | 31 | $("#button").attr("class", "selected"); |
| 32 | |||
| 31 | } | 33 | } |
| 32 | else { | 34 | else { |
| 33 | $("#button").attr("class", "unselected"); | 35 | $("#button").attr("class", "unselected"); |
| 36 | $("#image_browser").hide(); | ||
| 37 | $("#image_browser_toggle").attr("class", "unselected"); | ||
| 34 | } | 38 | } |
| 35 | 39 | ||
| 36 | return false; | 40 | return false; |
| @@ -119,10 +123,27 @@ image_interface = { | |||
| 119 | initialize : function() { | 123 | initialize : function() { |
| 120 | 124 | ||
| 121 | $("#image_browser").hide(); | 125 | $("#image_browser").hide(); |
| 122 | |||
| 123 | image_interface.bind_image_browser_toggle(); | ||
| 124 | image_interface.initialize_sortable_image_box(); | 126 | image_interface.initialize_sortable_image_box(); |
| 125 | image_interface.connect_browser_and_box(); | 127 | image_interface.connect_browser_and_box(); |
| 128 | image_interface.set_droppable_behavior(); | ||
| 129 | image_interface.bind_image_browser_toggle(); | ||
| 130 | }, | ||
| 131 | |||
| 132 | |||
| 133 | set_droppable_behavior : function() { | ||
| 134 | $("ul#image_box").droppable({ | ||
| 135 | out : function(event, ui) { | ||
| 136 | $(ui.draggable).fadeTo("fast", 0.4); | ||
| 137 | |||
| 138 | $(ui.draggable).bind("mouseup", function() { | ||
| 139 | $(this).remove(); | ||
| 140 | }); | ||
| 141 | }, | ||
| 142 | over : function(event, ui) { | ||
| 143 | $(ui.draggable).fadeTo("fast", 1.0); | ||
| 144 | $(ui.draggable).unbind("mouseup"); | ||
| 145 | } | ||
| 146 | }); | ||
| 126 | }, | 147 | }, |
| 127 | 148 | ||
| 128 | connect_browser_and_box : function() { | 149 | connect_browser_and_box : function() { |
| @@ -164,21 +185,7 @@ image_interface = { | |||
| 164 | }); | 185 | }); |
| 165 | } | 186 | } |
| 166 | } | 187 | } |
| 167 | }); | 188 | }); |
| 168 | |||
| 169 | $("ul#image_box").droppable({ | ||
| 170 | out : function(event, ui) { | ||
| 171 | $(ui.draggable).fadeTo("fast", 0.4); | ||
| 172 | |||
| 173 | $(ui.draggable).bind("mouseup", function() { | ||
| 174 | $(this).remove(); | ||
| 175 | }); | ||
| 176 | }, | ||
| 177 | over : function(event, ui) { | ||
| 178 | $(ui.draggable).fadeTo("fast", 1.0); | ||
| 179 | $(ui.draggable).unbind("mouseup"); | ||
| 180 | } | ||
| 181 | }); | ||
| 182 | }, | 189 | }, |
| 183 | 190 | ||
| 184 | bind_image_browser_toggle : function() { | 191 | bind_image_browser_toggle : function() { |
