summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-06-10 23:21:39 +0200
committerhukl <contact@smyck.org>2009-06-10 23:21:39 +0200
commit9c5108ffab6828562c5a976ddb92ac0ec459a9a3 (patch)
tree267099b94b50395ed629460d26f4e5641619de08 /app
parent45e067f1108748067b727a53e7826cebbb429792 (diff)
added basic ajax search interface. lots of css / js improvements needed but it seems to work quite okay for now. more on that tomorrow
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin_controller.rb15
-rw-r--r--app/views/layouts/admin.html.erb8
2 files changed, 23 insertions, 0 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index 55c66cf..8d7d2ea 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -12,4 +12,19 @@ class AdminController < ApplicationController
12 ) 12 )
13 end 13 end
14 14
15 def search
16 @results = Node.search params[:search_term]
17
18 respond_to do |format|
19 format.html
20 format.js do
21 render( :json => @results.map do |node|
22 {:id => node.id, :title => node.title}
23 end
24 )
25
26 end
27 end
28 end
29
15end 30end
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb
index 7902cae..fea6b5a 100644
--- a/app/views/layouts/admin.html.erb
+++ b/app/views/layouts/admin.html.erb
@@ -9,6 +9,7 @@
9 <%= stylesheet_link_tag 'admin' %> 9 <%= stylesheet_link_tag 'admin' %>
10 <%= javascript_include_tag 'jquery-1.3.2.min' %> 10 <%= javascript_include_tag 'jquery-1.3.2.min' %>
11 <%= javascript_include_tag 'tiny_mce/tiny_mce.js' %> 11 <%= javascript_include_tag 'tiny_mce/tiny_mce.js' %>
12 <%= javascript_include_tag 'admin_search.js' %>
12 <%= javascript_include_tag 'admin_interface.js' %> 13 <%= javascript_include_tag 'admin_interface.js' %>
13 14
14 <script type="text/javascript"> 15 <script type="text/javascript">
@@ -38,6 +39,11 @@
38 <div id="subnavigation"> 39 <div id="subnavigation">
39 <%= yield :subnavigation %> 40 <%= yield :subnavigation %>
40 </div> 41 </div>
42 <div id="admin_search">
43 <% form_tag admin_search_path do %>
44 <%= text_field_tag :search_term %>
45 <% end %>
46 </div>
41 <div style="clear: both"></div> 47 <div style="clear: both"></div>
42 <div id="flash"> 48 <div id="flash">
43 <%= flash[:notice] %> 49 <%= flash[:notice] %>
@@ -45,6 +51,8 @@
45 <div id="content"> 51 <div id="content">
46 <%= yield :layout %> 52 <%= yield :layout %>
47 </div> 53 </div>
54
55 <div id="results"></div>
48 </div> 56 </div>
49 </body> 57 </body>
50</html> 58</html>