Skip to content

Commit

Permalink
fixes search bar display on homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
mejackreed committed Jan 7, 2015
1 parent f717742 commit d72f8ca
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
10 changes: 9 additions & 1 deletion app/assets/stylesheets/geoblacklight/modules/home.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
}

.home-search-area {
text-align: center;

h2,
h3 {
text-align: center;
}

.input-group.search-input-group {
width: 100%;
}
}

.home-facet-link {
Expand Down
4 changes: 4 additions & 0 deletions app/helpers/geoblacklight_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def geoblacklight_icon(name)
content_tag :span, '', class: "geoblacklight-icon geoblacklight-#{name.downcase.gsub(' ', '-')}", title: name
end

def render_search_form_no_navbar
render partial: 'catalog/search_form_no_navbar'
end

##
# Renders an unique array of search links based off of terms
# passed in using the facet parameter
Expand Down
4 changes: 3 additions & 1 deletion app/views/catalog/_home_text.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<div class='home-search-area'>
<%= content_tag :h2, t('geoblacklight.home.headline') %>
<%= content_tag :h3, t('geoblacklight.home.search_heading') %>
<%= render_search_bar %>
<div class='col-md-6 col-md-offset-3'>
<%= render_search_form_no_navbar %>
</div>
</div>
</div>

Expand Down
20 changes: 20 additions & 0 deletions app/views/catalog/_search_form_no_navbar.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<%= form_tag search_action_url, :method => :get, :class => 'search-query-form clearfix' do %>
<%= render_hash_as_hidden_fields(params_for_search().except(:q, :search_field, :qt, :page, :utf8)) %>
<% unless search_fields.empty? %>
<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 form-control") %>
<span class="sr-only"><%= t('blacklight.search.form.search_field.post_label') %></span>
<% end %>
<div class="input-group search-input-group">
<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-primary 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 d72f8ca

Please sign in to comment.