diff options
| author | hukl <contact@smyck.org> | 2009-09-09 15:19:33 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-09-09 15:19:33 +0200 |
| commit | f7ce8c245fde3f6202103ae614b181c0ba44ed93 (patch) | |
| tree | 4625c54b0dfb31bdc3e71480fb8936fa5a6c0ca5 /public/javascripts/admin_search.js | |
| parent | f3a8cd8d1e8dfafb987163d95208e0ff2ccbfbc2 (diff) | |
added editing of slugs and moving of nodes. to edit a slug or move a node you edit that node, make your changes and save. the slug and parent node changes get staged and are applied once that revision is published
Diffstat (limited to 'public/javascripts/admin_search.js')
| -rw-r--r-- | public/javascripts/admin_search.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/public/javascripts/admin_search.js b/public/javascripts/admin_search.js index c08bdf3..6d3ca93 100644 --- a/public/javascripts/admin_search.js +++ b/public/javascripts/admin_search.js | |||
| @@ -163,3 +163,54 @@ parent_search = { | |||
| 163 | 163 | ||
| 164 | } | 164 | } |
| 165 | } | 165 | } |
| 166 | |||
| 167 | move_to_search = { | ||
| 168 | initialize_search : function() { | ||
| 169 | $("#move_to_search_term").bind("keyup", function() { | ||
| 170 | if ($(this).attr("value")) { | ||
| 171 | $.ajax({ | ||
| 172 | type: "GET", | ||
| 173 | url: "/admin/menu_search", | ||
| 174 | data: "search_term=" + $(this).attr("value"), | ||
| 175 | dataType: "json", | ||
| 176 | success : function(results) { | ||
| 177 | move_to_search.show_results(results); | ||
| 178 | } | ||
| 179 | }); | ||
| 180 | } | ||
| 181 | else { | ||
| 182 | $('#search_results').slideUp(); | ||
| 183 | $('#search_results').empty(); | ||
| 184 | } | ||
| 185 | }); | ||
| 186 | }, | ||
| 187 | |||
| 188 | show_results : function(results) { | ||
| 189 | $("#search_results").empty(); | ||
| 190 | for (result in results) { | ||
| 191 | var link = $(("<a href='#'>"+ results[result].title + "</a>")); | ||
| 192 | $(link).bind("click", move_to_search.link_closure(results[result])); | ||
| 193 | |||
| 194 | |||
| 195 | // Sometimes I don't get jquery; wrap() didn't work *sigh* | ||
| 196 | // Guess I'll need a book someday or another framework | ||
| 197 | var wrapper = $("<div></div>"); | ||
| 198 | $(wrapper).append(link) | ||
| 199 | |||
| 200 | $("#search_results").append(wrapper); | ||
| 201 | |||
| 202 | } | ||
| 203 | }, | ||
| 204 | |||
| 205 | link_closure : function(node) { | ||
| 206 | var barf = function(){ | ||
| 207 | $("#move_to_search_term").attr("value", node.title); | ||
| 208 | $("#node_staged_parent_id").attr("value", node.node_id); | ||
| 209 | $('#search_results').slideUp(); | ||
| 210 | $('#search_results').empty(); | ||
| 211 | return false; | ||
| 212 | } | ||
| 213 | |||
| 214 | return barf; | ||
| 215 | } | ||
| 216 | } \ No newline at end of file | ||
