Skip to content

Commit

Permalink
adding search type dropdown to front page
Browse files Browse the repository at this point in the history
  • Loading branch information
LBCC Library committed Apr 7, 2017
1 parent 359b833 commit 3c3e58c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/views/catalog/_home_text.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<input name="q" type="text" class="input-lg search-query col-xs-offset-1 col-xs-10" />
<input name="show_articles" id="show_articles" type="hidden" value="true"/>
</div>
<div class="row">
<%= render partial: 'search_field_dropdown', locals: {class_name: 'col-xs-offset-1 col-xs-10', select_class_name: 'form-control'} %>
</div>
<div class="row search-option-buttons">
<button type="submit" class="btn btn-success btn-lg col-xs-offset-1 col-xs-10 col-sm-4" onclick="document.getElementById('show_articles').value='true';" style="white-space: normal;"><span class="glyphicon glyphicon-search" aria-hidden="true"></span> Search all library resources</button>
<button type="submit" class="btn btn-success btn-lg col-sm-offset-2 hidden-xs col-sm-4" onclick="document.getElementById('show_articles').value='false';" style="white-space: normal;"><span class="glyphicon glyphicon-search" aria-hidden="true"></span> Search books and media only</button>
Expand Down
2 changes: 1 addition & 1 deletion app/views/catalog/_search_field_dropdown.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% unless search_fields.empty? %>
<span class="<%= class_name %>">
<label for="search_field" class="sr-only"><%= t('blacklight.search.form.search_field.label') %></label>
<%= 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) %>
<span class="sr-only"><%= t('blacklight.search.form.search_field.post_label') %></span>
</span>
<% end %>
16 changes: 16 additions & 0 deletions app/views/catalog/_search_form.html.erb
Original file line number Diff line number Diff line change
@@ -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)) %>

<div class="input-group">
<%= render partial: 'search_field_dropdown', locals: {class_name: 'input-group-addon', select_class_name: 'search_field'} %>
<label for="q" class="sr-only"><%= t('blacklight.search.form.q') %></label>
<%= 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? %>

<span class="input-group-btn">
<button type="submit" class="btn btn-success search-btn" id="search">
<span class="submit-search-text"><%=t('blacklight.search.form.submit')%></span>
<span class="glyphicon glyphicon-search"></span>
</button>
</span>
</div>
<% end %>

0 comments on commit 3c3e58c

Please sign in to comment.