-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Arrange HTML so that the search bar is part of the main element
Fixes #3252
- Loading branch information
Showing
5 changed files
with
65 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
<%= top_bar %> | ||
<%= search_bar %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 6 additions & 8 deletions
14
app/components/blacklight/search/sidebar_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
<search> | ||
<% facet_group_names.each do |groupname| %> | ||
<% fields = facet_fields_in_group(groupname) %> | ||
<%= render group_component_class.new(id: groupname, fields: fields, response: response) do |component| %> | ||
<% component.with_body do %> | ||
<%= render Blacklight::FacetComponent.with_collection(fields, response: response) %> | ||
<% end %> | ||
<% facet_group_names.each do |groupname| %> | ||
<% fields = facet_fields_in_group(groupname) %> | ||
<%= render group_component_class.new(id: groupname, fields: fields, response: response) do |component| %> | ||
<% component.with_body do %> | ||
<%= render Blacklight::FacetComponent.with_collection(fields, response: response) %> | ||
<% end %> | ||
<% end %> | ||
</search> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,39 @@ | ||
<search> | ||
<%= form_with url: @url, local: true, method: @method, class: @classes.join(' '), scope: @prefix, role: 'search', **@form_options do |f| %> | ||
<%= render Blacklight::HiddenSearchStateComponent.new(params: @params) %> | ||
<%= form_with url: @url, local: true, method: @method, class: @classes.join(' '), scope: @prefix, **@form_options do |f| %> | ||
<%= render Blacklight::HiddenSearchStateComponent.new(params: @params) %> | ||
<% if search_fields.length > 1 %> | ||
<%= f.label :search_field, scoped_t('search_field.label'), class: 'visually-hidden' %> | ||
<% end %> | ||
<% before_input_groups.each do |input_group| %> | ||
<%= input_group %> | ||
<% end %> | ||
<div class="input-group"> | ||
<%= prepend %> | ||
|
||
<% if search_fields.length > 1 %> | ||
<%= f.label :search_field, scoped_t('search_field.label'), class: 'visually-hidden' %> | ||
<% end %> | ||
<% before_input_groups.each do |input_group| %> | ||
<%= input_group %> | ||
<%= f.select(:search_field, | ||
options_for_select(search_fields, h(@search_field)), | ||
{}, | ||
title: scoped_t('search_field.title'), | ||
class: "custom-select form-select search-field") %> | ||
<% elsif search_fields.length == 1 %> | ||
<%= f.hidden_field :search_field, value: search_fields.first.last %> | ||
<% end %> | ||
<div class="input-group"> | ||
<%= prepend %> | ||
|
||
<% if search_fields.length > 1 %> | ||
<%= f.select(:search_field, | ||
options_for_select(search_fields, h(@search_field)), | ||
{}, | ||
title: scoped_t('search_field.title'), | ||
class: "custom-select form-select search-field") %> | ||
<% elsif search_fields.length == 1 %> | ||
<%= f.hidden_field :search_field, value: search_fields.first.last %> | ||
<% end %> | ||
|
||
<%= f.label @query_param, scoped_t('search.label'), class: 'visually-hidden' %> | ||
<% if autocomplete_path.present? %> | ||
<auto-complete src="<%= autocomplete_path %>" for="autocomplete-popup" class="search-autocomplete-wrapper form-control"> | ||
<%= f.search_field @query_param, value: @q, placeholder: scoped_t('search.placeholder'), class: "search-q q form-control rounded-#{search_fields.length > 1 ? '0' : 'left'}", autofocus: @autofocus, aria: { label: scoped_t('search.label'), autocomplete: 'list', controls: 'autocomplete-popup' } %> | ||
<ul id="autocomplete-popup" class="dropdown-menu" role="listbox" aria-label="<%= scoped_t('search.label') %>" hidden></ul> | ||
</auto-complete> | ||
<% else %> | ||
<%= f.search_field @query_param, value: @q, placeholder: scoped_t('search.placeholder'), class: "search-q q form-control rounded-#{search_fields.length > 1 ? '0' : 'left'}", autofocus: @autofocus, aria: { label: scoped_t('search.label') } %> | ||
<% end %> | ||
<%= f.label @query_param, scoped_t('search.label'), class: 'visually-hidden' %> | ||
<% if autocomplete_path.present? %> | ||
<auto-complete src="<%= autocomplete_path %>" for="autocomplete-popup" class="search-autocomplete-wrapper form-control"> | ||
<%= f.search_field @query_param, value: @q, placeholder: scoped_t('search.placeholder'), class: "search-q q form-control rounded-#{search_fields.length > 1 ? '0' : 'left'}", autofocus: @autofocus, aria: { label: scoped_t('search.label'), autocomplete: 'list', controls: 'autocomplete-popup' } %> | ||
<ul id="autocomplete-popup" class="dropdown-menu" role="listbox" aria-label="<%= scoped_t('search.label') %>" hidden></ul> | ||
</auto-complete> | ||
<% else %> | ||
<%= f.search_field @query_param, value: @q, placeholder: scoped_t('search.placeholder'), class: "search-q q form-control rounded-#{search_fields.length > 1 ? '0' : 'left'}", autofocus: @autofocus, aria: { label: scoped_t('search.label') } %> | ||
<% end %> | ||
|
||
<%= append %> | ||
<%= search_button || render(Blacklight::SearchButtonComponent.new(id: "#{@prefix}search", text: scoped_t('submit'))) %> | ||
</div> | ||
<% end %> | ||
<%= append %> | ||
<%= search_button || render(Blacklight::SearchButtonComponent.new(id: "#{@prefix}search", text: scoped_t('submit'))) %> | ||
</div> | ||
<% end %> | ||
|
||
<% if advanced_search_enabled? %> | ||
<%= link_to t('blacklight.advanced_search.more_options'), @advanced_search_url, class: 'advanced_search btn btn-secondary'%> | ||
<% end %> | ||
</search> | ||
<% if advanced_search_enabled? %> | ||
<%= link_to t('blacklight.advanced_search.more_options'), @advanced_search_url, class: 'advanced_search btn btn-secondary'%> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters