Permalink
Browse files

Add a search form.

Looks like ass now - this will slot in nicely with the Twitter bootstrap reskinning
  • Loading branch information...
elandesign committed Aug 13, 2012
1 parent caf1b13 commit d427dc6b781803746ddc8055c09dc5fe0fabc145
Showing with 13 additions and 1 deletion.
  1. +10 −0 app/helpers/application_helper.rb
  2. +3 −1 app/views/shared/_navigation.html.haml
@@ -61,6 +61,16 @@ def create_percentage_table_from_tallies(tallies, options={})
render "errs/tally_table", :rows => rows
end
+ def search_path
+ if params[:controller] == 'apps' && params[:action] == 'show'
+ search_app_errs_path(:app_id => params[:id])
+ elsif params[:app_id]
+ search_app_errs_path(:app_id => params[:app_id])
+ else
+ search_errs_path
+ end
+ end
+
private
def total_from_tallies(tallies)
tallies.values.inject(0) {|sum, n| sum + n}
@@ -5,4 +5,6 @@
%li.errs{:class => active_if_here(:errs)}= link_to 'Errors', errs_path
- if user_signed_in? && current_user.admin?
%li.users{:class => active_if_here(:users)}= link_to 'Users', users_path
- %div.clear
+ %div.clear
+ = form_tag search_path, {:class => 'navbar-search pull-left', :method => :get} do
+ %input{:type => 'text', :class => 'search-query span2', :placeholder => 'Search', :name => 'terms', :value => @search.present? ? @search.terms : ''}

0 comments on commit d427dc6

Please sign in to comment.