diff options
| author | hukl <contact@smyck.org> | 2009-09-08 16:35:22 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-09-08 16:35:22 +0200 |
| commit | b981d83e5e005817a67b11ccf92dd65bb506bcd4 (patch) | |
| tree | 046778c6ef694178b12acf28837aa63d6b0a7493 /public | |
| parent | 03bde9fb42235af7147d6312e2cf6d928111dee1 (diff) | |
new interface for adding nodes. still needs a bit radio button magick
Diffstat (limited to 'public')
| -rw-r--r-- | public/javascripts/admin_interface.js | 1 | ||||
| -rw-r--r-- | public/javascripts/admin_search.js | 54 | ||||
| -rw-r--r-- | public/stylesheets/admin.css | 8 |
3 files changed, 61 insertions, 2 deletions
diff --git a/public/javascripts/admin_interface.js b/public/javascripts/admin_interface.js index 57bf8c6..47a4bac 100644 --- a/public/javascripts/admin_interface.js +++ b/public/javascripts/admin_interface.js | |||
| @@ -3,6 +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 | parent_search.initialize_search(); | ||
| 6 | 7 | ||
| 7 | jQuery.ajaxSetup({ | 8 | jQuery.ajaxSetup({ |
| 8 | 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript");} | 9 | 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript");} |
diff --git a/public/javascripts/admin_search.js b/public/javascripts/admin_search.js index c8d269f..1800506 100644 --- a/public/javascripts/admin_search.js +++ b/public/javascripts/admin_search.js | |||
| @@ -95,5 +95,55 @@ menu_items = { | |||
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | return barf; | 97 | return barf; |
| 98 | } | 98 | } |
| 99 | }; \ No newline at end of file | 99 | }; |
| 100 | |||
| 101 | parent_search = { | ||
| 102 | initialize_search : function() { | ||
| 103 | $("#parent_search_term").bind("keyup", function() { | ||
| 104 | if ($(this).attr("value")) { | ||
| 105 | $.ajax({ | ||
| 106 | type: "GET", | ||
| 107 | url: "/admin/menu_search", | ||
| 108 | data: "search_term=" + $(this).attr("value"), | ||
| 109 | dataType: "json", | ||
| 110 | success : function(results) { | ||
| 111 | parent_search.show_results(results); | ||
| 112 | } | ||
| 113 | }); | ||
| 114 | } | ||
| 115 | else { | ||
| 116 | $('#search_results').slideUp(); | ||
| 117 | $('#search_results').empty(); | ||
| 118 | } | ||
| 119 | }); | ||
| 120 | }, | ||
| 121 | show_results : function(results) { | ||
| 122 | $("#search_results").empty(); | ||
| 123 | for (result in results) { | ||
| 124 | var link = $(("<a href='#' rel='" + results[result].id+ "'>"+ results[result].title + "</a>")); | ||
| 125 | $(link).bind("click", parent_search.link_closure(results[result])); | ||
| 126 | |||
| 127 | |||
| 128 | // Sometimes I don't get jquery; wrap() didn't work *sigh* | ||
| 129 | // Guess I'll need a book someday or another framework | ||
| 130 | var wrapper = $("<div></div>"); | ||
| 131 | $(wrapper).append(link) | ||
| 132 | |||
| 133 | $("#search_results").append(wrapper); | ||
| 134 | |||
| 135 | } | ||
| 136 | }, | ||
| 137 | link_closure : function(node) { | ||
| 138 | var barf = function(){ | ||
| 139 | $("#parent_search_term").attr("value", node.title); | ||
| 140 | alert(node.id); | ||
| 141 | $("#parent_id").attr("value", node.node_id); | ||
| 142 | $('#search_results').slideUp(); | ||
| 143 | $('#search_results').empty(); | ||
| 144 | return false; | ||
| 145 | } | ||
| 146 | |||
| 147 | return barf; | ||
| 148 | } | ||
| 149 | } | ||
diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css index f7ef868..9fa503b 100644 --- a/public/stylesheets/admin.css +++ b/public/stylesheets/admin.css | |||
| @@ -276,6 +276,14 @@ textarea#page_abstract { | |||
| 276 | margin-left: -125px; | 276 | margin-left: -125px; |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | #new_node { | ||
| 280 | margin-left: -118px; | ||
| 281 | } | ||
| 282 | |||
| 283 | #new_node input[type=text] { | ||
| 284 | width: 350px; | ||
| 285 | } | ||
| 286 | |||
| 279 | tr {} | 287 | tr {} |
| 280 | 288 | ||
| 281 | td { | 289 | td { |
