summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-09-06 21:51:31 +0200
committerhukl <contact@smyck.org>2009-09-06 21:51:31 +0200
commit8f2dc36616548650000308ebc8b1f9e2947c0ef9 (patch)
tree79f1226c6f7646b1bbe57634c848e44d426bd01f /app
parent5c90701cdf3ad475840a76f096f1b74ff68fbd0f (diff)
parentd555e1b27df1096e8899f2e50c8d6421f4c1cca3 (diff)
Merge branch 'public_search'
Diffstat (limited to 'app')
-rw-r--r--app/controllers/search_controller.rb11
-rw-r--r--app/helpers/search_helper.rb2
-rw-r--r--app/views/layouts/application.html.erb10
-rw-r--r--app/views/search/index.html.erb15
4 files changed, 38 insertions, 0 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
new file mode 100644
index 0000000..97ecdfd
--- /dev/null
+++ b/app/controllers/search_controller.rb
@@ -0,0 +1,11 @@
1class SearchController < ApplicationController
2 def index
3 @page = Page.new
4 search_term = params[:search_term]
5 if search_term and not search_term.empty?
6 nodes = Node.search(params[:search_term])
7 @results = nodes.map {|node| node.head}
8 end
9 end
10
11end
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
new file mode 100644
index 0000000..b3ce20a
--- /dev/null
+++ b/app/helpers/search_helper.rb
@@ -0,0 +1,2 @@
1module SearchHelper
2end
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 69db939..0b32673 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -14,6 +14,16 @@
14 <div id="header"> 14 <div id="header">
15 <%= image_tag "header.png" %> 15 <%= image_tag "header.png" %>
16 </div> 16 </div>
17 <div id="search">
18 <table>
19 <% form_tag search_path, :method => 'get' do %>
20 <tr>
21 <td><%= text_field_tag :search_term %></td>
22 <td style="padding-top: 2px"><%= image_submit_tag("search_button.png") %></td>
23 </tr>
24 <% end %>
25 </table>
26 </div>
17 <div id="left_column"> 27 <div id="left_column">
18 <%= main_menu %> 28 <%= main_menu %>
19 29
diff --git a/app/views/search/index.html.erb b/app/views/search/index.html.erb
new file mode 100644
index 0000000..28764bf
--- /dev/null
+++ b/app/views/search/index.html.erb
@@ -0,0 +1,15 @@
1<h2>Suche</h2>
2
3
4
5<% if params[:search_term] %>
6 <h3>Suchergebnisse für Suchbegriff: <%= params[:search_term] %></h3>
7<% end %>
8
9<%=
10 render(
11 :partial => 'custom/partials/article',
12 :collection => @results,
13 :as => :page
14 )
15%> \ No newline at end of file