From 3c3e58c9a0c4f0ea42f9d71d1f7ebe5515c779dc Mon Sep 17 00:00:00 2001 From: LBCC Library Date: Fri, 7 Apr 2017 09:57:19 -0700 Subject: [PATCH] adding search type dropdown to front page --- app/views/catalog/_home_text.html.erb | 3 +++ .../catalog/_search_field_dropdown.html.erb | 2 +- app/views/catalog/_search_form.html.erb | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 app/views/catalog/_search_form.html.erb diff --git a/app/views/catalog/_home_text.html.erb b/app/views/catalog/_home_text.html.erb index 1ecd20a..9d7503a 100644 --- a/app/views/catalog/_home_text.html.erb +++ b/app/views/catalog/_home_text.html.erb @@ -7,6 +7,9 @@ +
+ <%= render partial: 'search_field_dropdown', locals: {class_name: 'col-xs-offset-1 col-xs-10', select_class_name: 'form-control'} %> +
diff --git a/app/views/catalog/_search_field_dropdown.html.erb b/app/views/catalog/_search_field_dropdown.html.erb index a01b323..f451e4f 100644 --- a/app/views/catalog/_search_field_dropdown.html.erb +++ b/app/views/catalog/_search_field_dropdown.html.erb @@ -1,7 +1,7 @@ <% unless search_fields.empty? %> - <%= select_tag(:search_field, options_for_select(search_fields, h(params[:search_field])), :title => t('blacklight.search.form.search_field.title'), :class=>"search_field") %> + <%= select_tag(:search_field, options_for_select(search_fields, h(params[:search_field])), :title => t('blacklight.search.form.search_field.title'), :class=>select_class_name) %> <%= t('blacklight.search.form.search_field.post_label') %> <% end %> diff --git a/app/views/catalog/_search_form.html.erb b/app/views/catalog/_search_form.html.erb new file mode 100644 index 0000000..7a8f56b --- /dev/null +++ b/app/views/catalog/_search_form.html.erb @@ -0,0 +1,16 @@ + <%= form_tag search_action_url, :method => :get, :class => 'search-query-form form-inline clearfix navbar-form hidden-xs' do %> + <%= render_hash_as_hidden_fields(params_for_search().except(:q, :search_field, :qt, :page, :utf8)) %> + +
+ <%= render partial: 'search_field_dropdown', locals: {class_name: 'input-group-addon', select_class_name: 'search_field'} %> + + <%= text_field_tag :q, params[:q], :placeholder => t('blacklight.search.form.q'), :class => "search_q q form-control", :id => "q", :autofocus => should_autofocus_on_search_box? %> + + + + +
+ <% end %>