From 7fe444ede64e7209208f7c09150f8c0069b075ca Mon Sep 17 00:00:00 2001 From: Adam Ploshay Date: Fri, 25 Oct 2024 14:04:45 -0400 Subject: [PATCH 1/2] [ESSI-2025] prepare campus-specific #link_to_facet --- app/helpers/facet_helper.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/helpers/facet_helper.rb b/app/helpers/facet_helper.rb index a0a66365..eba05c2c 100644 --- a/app/helpers/facet_helper.rb +++ b/app/helpers/facet_helper.rb @@ -2,4 +2,13 @@ module FacetHelper def campus_label(value) CampusService.find(value)[:term] || '' end + + # imported from hyrax to prep campus-specific version + # @param item [Object] + # @param field [String] + # @return [ActiveSupport::SafeBuffer] the html_safe link + def link_to_facet(item, field) + path = main_app.search_catalog_path(search_state.add_facet_params_and_redirect(field, item)) + link_to(item, path) + end end From ec5a96580a4ad43528c58e7bcb8948ed0c6526ad Mon Sep 17 00:00:00 2001 From: Adam Ploshay Date: Fri, 25 Oct 2024 14:06:06 -0400 Subject: [PATCH 2/2] [ESSI-2025] add, use #link_to_campus_facet --- app/helpers/facet_helper.rb | 5 +++-- app/views/records/show_fields/_campus.html.erb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/helpers/facet_helper.rb b/app/helpers/facet_helper.rb index eba05c2c..ad27de77 100644 --- a/app/helpers/facet_helper.rb +++ b/app/helpers/facet_helper.rb @@ -3,12 +3,13 @@ def campus_label(value) CampusService.find(value)[:term] || '' end - # imported from hyrax to prep campus-specific version + # campus-specific version of link_to_facet # @param item [Object] # @param field [String] # @return [ActiveSupport::SafeBuffer] the html_safe link - def link_to_facet(item, field) + def link_to_campus_facet(item, field) path = main_app.search_catalog_path(search_state.add_facet_params_and_redirect(field, item)) + item = campus_label(item) link_to(item, path) end end diff --git a/app/views/records/show_fields/_campus.html.erb b/app/views/records/show_fields/_campus.html.erb index 0a602f02..ddacf791 100644 --- a/app/views/records/show_fields/_campus.html.erb +++ b/app/views/records/show_fields/_campus.html.erb @@ -1 +1 @@ -<%= link_to_facet(record.campus, Solrizer.solr_name("campus", :facetable)) %>
+<%= link_to_campus_facet(record.campus, Solrizer.solr_name("campus", :facetable)) %>