From f90dca555247651c580f879a22d932f378a34ce9 Mon Sep 17 00:00:00 2001 From: hukl Date: Sun, 6 Sep 2009 19:35:12 +0200 Subject: added public search controller with corresponding view --- app/controllers/search_controller.rb | 11 +++++++++++ app/helpers/search_helper.rb | 2 ++ app/views/search/index.html.erb | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 app/controllers/search_controller.rb create mode 100644 app/helpers/search_helper.rb create mode 100644 app/views/search/index.html.erb (limited to 'app') 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 @@ +class SearchController < ApplicationController + def index + @page = Page.new + search_term = params[:search_term] + if search_term and not search_term.empty? + nodes = Node.search(params[:search_term]) + @results = nodes.map {|node| node.head} + end + end + +end 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 @@ +module SearchHelper +end diff --git a/app/views/search/index.html.erb b/app/views/search/index.html.erb new file mode 100644 index 0000000..2e46d20 --- /dev/null +++ b/app/views/search/index.html.erb @@ -0,0 +1,19 @@ +

Suche

+ +<% form_tag search_path, :method => 'get' do %> + <%= text_field_tag :search_term %> + <%= submit_tag "Suchen" %> +<% end %> + + +<% if params[:search_term] %> +

Suchergebnisse für Suchbegriff: <%= params[:search_term] %>

+<% end %> + +<%= + render( + :partial => 'custom/partials/article', + :collection => @results, + :as => :page + ) +%> \ No newline at end of file -- cgit v1.3 From d555e1b27df1096e8899f2e50c8d6421f4c1cca3 Mon Sep 17 00:00:00 2001 From: hukl Date: Sun, 6 Sep 2009 21:50:42 +0200 Subject: search field now at the right position with image button and image textfield --- app/views/layouts/application.html.erb | 10 ++++++++++ app/views/search/index.html.erb | 4 ---- public/images/search_button.png | Bin 0 -> 4272 bytes public/images/search_field.png | Bin 0 -> 2941 bytes public/stylesheets/ccc.css | 30 +++++++++++++++++++++++++++++- 5 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 public/images/search_button.png create mode 100644 public/images/search_field.png (limited to 'app') 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 @@ +
<%= main_menu %> diff --git a/app/views/search/index.html.erb b/app/views/search/index.html.erb index 2e46d20..28764bf 100644 --- a/app/views/search/index.html.erb +++ b/app/views/search/index.html.erb @@ -1,9 +1,5 @@

Suche

-<% form_tag search_path, :method => 'get' do %> - <%= text_field_tag :search_term %> - <%= submit_tag "Suchen" %> -<% end %> <% if params[:search_term] %> diff --git a/public/images/search_button.png b/public/images/search_button.png new file mode 100644 index 0000000..9a59f04 Binary files /dev/null and b/public/images/search_button.png differ diff --git a/public/images/search_field.png b/public/images/search_field.png new file mode 100644 index 0000000..1ee523d Binary files /dev/null and b/public/images/search_field.png differ diff --git a/public/stylesheets/ccc.css b/public/stylesheets/ccc.css index 3ef7975..3417fef 100644 --- a/public/stylesheets/ccc.css +++ b/public/stylesheets/ccc.css @@ -107,7 +107,7 @@ div#left_column { div#center_column { position: absolute; background-color: #ffffff; - left: 185px; + left: 200px; width: 460px; padding-left: 15px; padding-right: 15px; @@ -139,4 +139,32 @@ div.article_partial h2 a { div.article_partial p.excerpt { color: #404040; +} + +div#search { + position: absolute; + top: 145px; + left: 676px; + height: 1000px; + vertical-align: top; +} + +div#search input[type=button] { + display: block; + height: 20px; +} + +div#search input[type=text] { + display: block; + padding: 0px; + margin: 0px; + height: 20px; + width: 132px; + line-height: 20px; + border: none; + background-image: url(/images/search_field.png); + background-repeat:no-repeat; + padding-right: 5px; + margin-right: 5px; + background-position: top top; } \ No newline at end of file -- cgit v1.3