Skip to content

Commit

Permalink
deprecate 'search_sidebar' partial (replaced w/ componenent in BL8); …
Browse files Browse the repository at this point in the history
…override 'catalog/index.html.erb' to render 'local_filter' instead
  • Loading branch information
zeke-graves committed Sep 27, 2024
1 parent 037bcfb commit de4938b
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 39 deletions.
81 changes: 42 additions & 39 deletions app/views/catalog/_local_filter.html.erb
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="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) }) %>

<% 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="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 id="viewAllResults" class="clearfix" role="navigation" aria-label="Searching (context)">
<div id="trln-toggle" class="sidenav facets top-panel-heading">
<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>
1 change: 1 addition & 0 deletions app/views/catalog/_search_sidebar.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<% # this partial is deprecated with BL8. catalog/index now renders the sidebar component %>
<% inst = TrlnArgon::Engine.configuration.local_institution_code #vs ENV["LOCAL_INSTITUTION_CODE"]%>
<% instname = TrlnArgon::LookupManager.instance.map("#{inst}.facet.#{inst}") %>

Expand Down
26 changes: 26 additions & 0 deletions app/views/catalog/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<% # TRLN override of BL8 catalog/index view %>
<% content_for(:head) do %>
<meta name="blacklight-search-storage" content="<%= blacklight_config.track_search_session.storage %>">
<% end %>
<% content_for(:sidebar) do %>
<!-- Render the new custom TRLN view partial -->
<%= render 'catalog/local_filter',
search_state: search_state,
local_button_id: 'toggle-local-btn-top',
trln_button_id: 'toggle-trln-btn-top' %>

<!-- Continue rendering Blacklight 8's sidebar component -->
<% conf = blacklight_config.view_config(document_index_view_type) %>
<%= render conf.sidebar_component.new(blacklight_config: blacklight_config,
response: @response,
view_config: conf) %>
<% end %>

<% unless has_search_parameters? %>
<%# if there are no input/search related params, display the "home" partial -%>
<%= render 'home' %>
<%= render 'shared/sitelinks_search_box' %>
<% else %>
<%= render 'search_results' %>
<% end %>

0 comments on commit de4938b

Please sign in to comment.