-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
consolidate search bar component templates and refactor searchpag for…
… mobile (DLC-1118) - add a missing translation for query field labels
- Loading branch information
Showing
20 changed files
with
201 additions
and
142 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
2 changes: 1 addition & 1 deletion
2
app/components/dcv/response/collapsible_pagination_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 +1 @@ | ||
<%= helpers.paginate @response, :page_entries_info => helpers.page_entries_info(@response), :theme => :dcv_collapsible %> | ||
<%= helpers.paginate @response, page_entries_info: helpers.page_entries_info(@response), theme: :dcv_collapsible, paginator_class: paginator_class %> |
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
This file was deleted.
Oops, something went wrong.
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
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,34 +1,34 @@ | ||
<%= form_tag @url, method: :get, class: ['d-flex','flex-md-row-reverse','flex-sm-column','w-100'] do %> | ||
<%= render_hash_as_hidden_fields(@params.except(:q, :search_field, :qt, :page, :utf8, :format, :slug, :site_slug)) %> | ||
<%= render_hash_as_hidden_fields(search_action_params) %> | ||
<div class="input-group flex-sm-row flex-md-fill"> | ||
<%= render pagination_component %> | ||
<div class="input-group-prepend collapseSearch flex-fill p-0<%= ' collapse' if pagination_component.render?%>" id="collapseQuery"> | ||
<% unless search_fields.empty? %> | ||
<span class="input-group-append p-0<%= ' hidden' if search_fields.length == 1 %>"> | ||
<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: 'btn search-btn btn-primary rounded-0' | ||
) | ||
%> | ||
<span class="sr-only"><%= t('blacklight.search.form.search_field.post_label') %></span> | ||
</span> | ||
<% end %> | ||
<%= form_tag @url, method: :get, class: ['form-inline','flex-md-row-reverse','flex-sm-column','w-100'] do %> | ||
<%= render_hash_as_hidden_fields(params_for_new_search) %> | ||
<%- rendering_pagination = pagination_will_render? -%> | ||
<div class="input-group flex-fill flex-nowrap align-content-end"> | ||
<div class="btn-group input-group-prepend btn-group-toggle flex-shrink-0" data-toggle="buttons"> | ||
<label for="show-search-mode" class="btn btn-secondary border-info rounded-left<%= ' active' unless rendering_pagination %>" onclick="if ($('#collapseQuery').hasClass('show')) return false;"> | ||
<input type="radio" name="searchpag-mode" id="show-search-mode" aria-label="Show search box" aria-controls="collapseQuery collapsePag" <%= 'disabled ' unless rendering_pagination %>data-toggle="collapse" data-target=".collapseSearch" aria-expanded="false"> | ||
<i class="previous fa fa-binoculars" title="Show search box" data-toggle="tooltip" data-original-title="Show search box"></i> | ||
</label> | ||
<label for="show-pag-mode" class="btn btn-secondary border-info<%= rendering_pagination ? ' active' : ' disabled' %>" onclick="if ($('#collapsePag').hasClass('show')) return false;"> | ||
<input type="radio" name="searchpag-mode" id="show-pag-mode" aria-label="Navigate results" aria-controls="collapseQuery collapsePag" <%= rendering_pagination ? 'checked ' : ' disabled' %>data-toggle="collapse" data-target=".collapseSearch" aria-expanded="false"> | ||
<i class="previous fa fa-book-open-reader" title="Navigate results" data-toggle="tooltip" data-original-title="Navigate results"></i> | ||
</label> | ||
</div> | ||
<%= render pagination_component %> | ||
<div class="input-group-prepend p-0 flex-grow-1 collapseSearch<%= ' collapse' if rendering_pagination %>" id="collapseQuery"> | ||
<%= render search_fields_component %> | ||
<div class="flex-fill flex-shrink-1"> | ||
<input type="hidden" name="search_field" value="all_text_teim"> | ||
<label for="q" class="sr-only"><%= t('blacklight.search.form.q') %></label> | ||
<%= text_field_tag :q, params[:q], :placeholder => search_placeholder_text, :class => "search_q q flex-fill bg-white", :id => "q" %> | ||
<div class="input-group-append"> | ||
<%= link_to '<i class="fa fa-remove"></i>'.html_safe, start_over_path, :title => 'Start Over', :class => 'btn bg-body btn-outline-info reset-btn' if query_has_constraints? %> | ||
<button class="btn btn-splash" type="submit" aria-label="Submit"> | ||
<span class="hidden-xs"><%= (current_page?(root_url)? t('blacklight.search.form.submit') : '') %></span> | ||
<span class="fa fa-search"></span> | ||
</button> | ||
</div> | ||
<%= text_field_tag :q, params[:q], placeholder: search_placeholder_text, class: "search_q q bg-white form-control w-100", id: "q", tabindex: "1" %> | ||
</div> | ||
<div class="btn-group input-group-append"> | ||
<%= render format_filter_component %> | ||
<%= link_to '<i class="fa fa-remove"></i>'.html_safe, start_over_path, :title => 'Start Over', :class => 'btn btn-secondary reset-btn' if query_has_constraints? %> | ||
<button class="btn btn-splash" type="submit"> | ||
<span class="hidden-xs"><%= (current_page?(root_url)? t('blacklight.search.form.submit') : '') %></span> | ||
<span class="fa fa-search"></span> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<% end %> | ||
<% 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
This file was deleted.
Oops, something went wrong.
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
11 changes: 11 additions & 0 deletions
11
app/components/dcv/search_bar/format_filter_dropdown_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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div class="dropdown"> | ||
<button id="format_type_select" type="button" class="btn btn-splash dropdown-toggle d-inline" data-toggle="dropdown" aria-expanded="false" onclick="$(this).dropdown(); return false;" aria-controls="format_filter" aria-pressed="false" data-reference="parent"><span class="d-none d-md-inline">Formats</span> | ||
<span class="sr-only">Toggle Dropdown</span> | ||
</button> | ||
<ul id="format_filter" class="dropdown-menu dropdown-menu-left hide" role="menu"> | ||
<li class="dropdown-header text-light">Limit search to:</li> | ||
<% format_filter_list.each do | key, display_label | %> | ||
<li class="dropdown-item text-light"><input type="checkbox" name="f[lib_format_sim][]" <%= (params[:f] && params[:f]['lib_format_sim'] && params[:f]['lib_format_sim'].include?(key)) ? 'checked="checked"' : '' %> value="<%= key %>"> <%= display_label %></li> | ||
<% end %> | ||
</ul> | ||
</div> |
17 changes: 17 additions & 0 deletions
17
app/components/dcv/search_bar/format_filter_dropdown_component.rb
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module Dcv::SearchBar | ||
class FormatFilterDropdownComponent < Blacklight::Component | ||
def initialize(format_filter_list: nil) | ||
@format_filter_list = format_filter_list | ||
end | ||
|
||
def render? | ||
@format_filter_list | ||
end | ||
|
||
def format_filter_list | ||
@format_filter_list | ||
end | ||
end | ||
end |
25 changes: 0 additions & 25 deletions
25
app/components/dcv/search_bar/repositories_component.html.erb
This file was deleted.
Oops, something went wrong.
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
5 changes: 5 additions & 0 deletions
5
app/components/dcv/search_bar/search_fields/hidden_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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<% unless search_fields.blank? %> | ||
<span class="input-group-append"> | ||
<%= hidden_field_tag(:search_field, h(params[:search_field] || search_fields.first[1]), :title => t('blacklight.search.form.search_field.title')) %> | ||
</span> | ||
<% end %> |
6 changes: 6 additions & 0 deletions
6
app/components/dcv/search_bar/search_fields/hidden_component.rb
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
module Dcv::SearchBar::SearchFields | ||
class HiddenComponent < SelectComponent | ||
end | ||
end |
7 changes: 7 additions & 0 deletions
7
app/components/dcv/search_bar/search_fields/select_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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<% unless search_fields.empty? %> | ||
<span class="input-group-prepend <%= 'hidden' if search_fields && search_fields.length < 2 %>"> | ||
<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") %> | ||
<span class="sr-only"><%= t('blacklight.search.form.search_field.post_label') %></span> | ||
</span> | ||
<% end %> |
17 changes: 17 additions & 0 deletions
17
app/components/dcv/search_bar/search_fields/select_component.rb
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module Dcv::SearchBar::SearchFields | ||
class SelectComponent < Blacklight::Component | ||
def initialize(search_fields: nil) | ||
@search_fields = search_fields | ||
end | ||
|
||
def render? | ||
search_fields | ||
end | ||
|
||
def search_fields | ||
@search_fields | ||
end | ||
end | ||
end |
Oops, something went wrong.