-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TD-1337 restore local filter #436
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ae535c1
override BL8 sidebar component to render 'local_filter' partial; depr…
zinc-glaze 53d2522
subclass sidebar component; configure index view to use sidebar overr…
zinc-glaze b73642b
fix rubocop errors
zinc-glaze 8bf2a69
remove redundant code from sidebar_component override
zinc-glaze File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
app/components/trln_argon/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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<% # TRLN override of BL8 sidebar component %> | ||
<%= render 'catalog/local_filter', | ||
local_button_id: 'toggle-local-btn-top', | ||
trln_button_id: 'toggle-trln-btn-top' %> | ||
|
||
<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 %> | ||
<% end %> | ||
<% end %> | ||
</search> |
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,18 @@ | ||
# frozen_string_literal: true | ||
|
||
module TrlnArgon | ||
module Search | ||
class SidebarComponent < Blacklight::Search::SidebarComponent | ||
def initialize(blacklight_config:, response:, view_config:) | ||
super(blacklight_config: blacklight_config, response: response, view_config: view_config) | ||
@blacklight_config = blacklight_config | ||
@response = response | ||
@group_component_class = view_config.facet_group_component || Blacklight::Response::FacetGroupComponent | ||
end | ||
|
||
attr_reader :group_component_class, :response | ||
|
||
delegate :facet_group_names, :facet_fields_in_group, to: :@blacklight_config | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,45 @@ | ||
<h2 class="local-filter-heading" id="<%= local_filter_id %>"><%= t("trln_argon.local_filter.showing_results") %></h2> | ||
|
||
<% query_state = query_state_from_search_state(search_state) %> | ||
<% query_state.delete('page') %> | ||
<% query_state.fetch('f', {}).delete(TrlnArgon::Fields::LOCATION_HIERARCHY_FACET.to_s) %> | ||
|
||
<div class="toggle toggle-local"> | ||
|
||
<%= button_tag( type: "button", | ||
id: local_button_id, | ||
class: "btn btn-md #{local_search_button_class}", | ||
title: "#{t("trln_argon.local_filter.search_verb")} #{t("trln_argon.local_filter.searching_local", local_institution_name: institution_long_name)}", | ||
onclick: "window.location='#{search_catalog_path(query_state)}'" | ||
) do %> | ||
<span class="visually-hidden">icon</span><span class="icon-wrapper"></span> | ||
<% end %> | ||
|
||
<%= label_tag( local_button_id, | ||
t("trln_argon.local_filter.searching_local", local_institution_name: institution_long_name), | ||
class: "#{local_search_button_label_class}", | ||
data: { count_only_path: trln_argon.catalog_count_only_path(query_state) }) %> | ||
|
||
<% inst = TrlnArgon::Engine.configuration.local_institution_code %> | ||
<% instname = TrlnArgon::LookupManager.instance.map("#{inst}.facet.#{inst}") %> | ||
|
||
<div id="location-data" | ||
data-argon-institution="<%= instname %>" | ||
data-argon-hsl="<%= TrlnArgon::LookupManager.instance.map('hsl.facet.hsl') %>" | ||
data-argon-law="<%= TrlnArgon::LookupManager.instance.map('law.facet.law') %>" | ||
data-location-facet-limit="<%= TrlnArgon::Engine.configuration.number_of_location_facets %>"> | ||
</div> | ||
|
||
|
||
<div class="toggle toggle-trln"> | ||
|
||
<%= button_tag( type: "button", | ||
id: trln_button_id, | ||
class: "btn btn-md #{trln_search_button_class}", | ||
title: "#{t("trln_argon.local_filter.search_verb")} #{t("trln_argon.local_filter.searching_trln")}", | ||
onclick: "window.location='#{search_trln_path(query_state)}'" | ||
) do %> | ||
<span class="visually-hidden">icon</span><span class="icon-wrapper"></span> | ||
<% end %> | ||
|
||
<%= label_tag( trln_button_id, | ||
"#{t("trln_argon.local_filter.searching_trln")}", | ||
class: "#{trln_search_button_label_class}", | ||
data: { count_only_path: trln_argon.trln_count_only_path(query_state) }) %> | ||
|
||
</div> | ||
<div id="trln-toggle" class="sidenav facets top-panel-heading"> | ||
<div id="viewAllResults" class="clearfix" role="navigation" aria-label="Searching (context)"> | ||
<h2 class="local-filter-heading" id="localFilterLabelFacets"> | ||
<%= t("trln_argon.local_filter.showing_results") %> | ||
</h2> | ||
|
||
<% query_state = query_state_from_search_state(search_state) %> | ||
<% query_state.delete('page') %> | ||
<% query_state.fetch('f', {}).delete(TrlnArgon::Fields::LOCATION_HIERARCHY_FACET.to_s) %> | ||
|
||
<div class="toggle toggle-local"> | ||
<%= button_tag(type: "button", id: local_button_id, class: "btn btn-md #{local_search_button_class}", | ||
title: "#{t('trln_argon.local_filter.search_verb')} #{t('trln_argon.local_filter.searching_local', local_institution_name: institution_long_name)}", | ||
onclick: "window.location='#{search_catalog_path(query_state)}'") do %> | ||
<span class="sr-only">icon</span><span class="icon-wrapper"></span> | ||
<% end %> | ||
|
||
<%= label_tag(local_button_id, t('trln_argon.local_filter.searching_local', local_institution_name: institution_long_name), | ||
class: "#{local_search_button_label_class}", | ||
data: { count_only_path: trln_argon.catalog_count_only_path(query_state) }) %> | ||
</div> | ||
|
||
<div class="toggle toggle-trln"> | ||
<%= button_tag(type: "button", id: trln_button_id, class: "btn btn-md #{trln_search_button_class}", | ||
title: "#{t('trln_argon.local_filter.search_verb')} #{t('trln_argon.local_filter.searching_trln')}", | ||
onclick: "window.location='#{search_trln_path(query_state)}'") do %> | ||
<span class="sr-only">icon</span><span class="icon-wrapper"></span> | ||
<% end %> | ||
|
||
<%= label_tag(trln_button_id, t('trln_argon.local_filter.searching_trln'), | ||
class: "#{trln_search_button_label_class}", | ||
data: { count_only_path: trln_argon.trln_count_only_path(query_state) }) %> | ||
</div> | ||
</div> | ||
</div> |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove lines 6-15 here, which will spare us from having to reconcile this code frequently against upstream Blacklight to make sure it matches.