diff options
| author | hukl <contact@smyck.org> | 2009-09-08 20:06:44 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-09-08 20:06:44 +0200 |
| commit | b48ee28e586fd75e84e33fabfcba70c05d32a606 (patch) | |
| tree | 3654bd300fa8a2a387c50b53d23c794da49762d0 /public | |
| parent | b981d83e5e005817a67b11ccf92dd65bb506bcd4 (diff) | |
lots of gui improvements for creating nodes
Diffstat (limited to 'public')
| -rw-r--r-- | public/javascripts/admin_search.js | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/public/javascripts/admin_search.js b/public/javascripts/admin_search.js index 1800506..f670273 100644 --- a/public/javascripts/admin_search.js +++ b/public/javascripts/admin_search.js | |||
| @@ -100,6 +100,8 @@ menu_items = { | |||
| 100 | 100 | ||
| 101 | parent_search = { | 101 | parent_search = { |
| 102 | initialize_search : function() { | 102 | initialize_search : function() { |
| 103 | parent_search.initialize_radio_buttons(); | ||
| 104 | |||
| 103 | $("#parent_search_term").bind("keyup", function() { | 105 | $("#parent_search_term").bind("keyup", function() { |
| 104 | if ($(this).attr("value")) { | 106 | if ($(this).attr("value")) { |
| 105 | $.ajax({ | 107 | $.ajax({ |
| @@ -118,10 +120,11 @@ parent_search = { | |||
| 118 | } | 120 | } |
| 119 | }); | 121 | }); |
| 120 | }, | 122 | }, |
| 123 | |||
| 121 | show_results : function(results) { | 124 | show_results : function(results) { |
| 122 | $("#search_results").empty(); | 125 | $("#search_results").empty(); |
| 123 | for (result in results) { | 126 | for (result in results) { |
| 124 | var link = $(("<a href='#' rel='" + results[result].id+ "'>"+ results[result].title + "</a>")); | 127 | var link = $(("<a href='#'>"+ results[result].title + "</a>")); |
| 125 | $(link).bind("click", parent_search.link_closure(results[result])); | 128 | $(link).bind("click", parent_search.link_closure(results[result])); |
| 126 | 129 | ||
| 127 | 130 | ||
| @@ -134,10 +137,10 @@ parent_search = { | |||
| 134 | 137 | ||
| 135 | } | 138 | } |
| 136 | }, | 139 | }, |
| 140 | |||
| 137 | link_closure : function(node) { | 141 | link_closure : function(node) { |
| 138 | var barf = function(){ | 142 | var barf = function(){ |
| 139 | $("#parent_search_term").attr("value", node.title); | 143 | $("#parent_search_term").attr("value", node.title); |
| 140 | alert(node.id); | ||
| 141 | $("#parent_id").attr("value", node.node_id); | 144 | $("#parent_id").attr("value", node.node_id); |
| 142 | $('#search_results').slideUp(); | 145 | $('#search_results').slideUp(); |
| 143 | $('#search_results').empty(); | 146 | $('#search_results').empty(); |
| @@ -145,5 +148,20 @@ parent_search = { | |||
| 145 | } | 148 | } |
| 146 | 149 | ||
| 147 | return barf; | 150 | return barf; |
| 151 | }, | ||
| 152 | |||
| 153 | initialize_radio_buttons : function() { | ||
| 154 | $("#kind_top_level").bind("change", function(){ | ||
| 155 | $("#parent_search_field").hide(); | ||
| 156 | }); | ||
| 157 | |||
| 158 | $("#kind_update").bind("change", function(){ | ||
| 159 | $("#parent_search_field").hide(); | ||
| 160 | }); | ||
| 161 | |||
| 162 | $("#kind_generic").bind("change", function(){ | ||
| 163 | $("#parent_search_field").show(); | ||
| 164 | }); | ||
| 165 | |||
| 148 | } | 166 | } |
| 149 | } | 167 | } |
