-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #649 from IU-Libraries-Joint-Development/essi-2055…
…_campus_in_manifest [ESSI-2055] fix campus facet link text in manifest
- Loading branch information
Showing
2 changed files
with
21 additions
and
0 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
20 changes: 20 additions & 0 deletions
20
lib/extensions/iiif_print/metadata/faceted_values_for_campus.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,20 @@ | ||
# modified from iiif_print to handle campus display | ||
module Extensions | ||
module IiifPrint | ||
module Metadata | ||
module FacetedValuesForCampus | ||
def faceted_values_for(field_name:) | ||
values_for(field_name: field_name).map do |value| | ||
search_field = field_name.to_s + "_sim" | ||
path = Rails.application.routes.url_helpers.search_catalog_path( | ||
"f[#{search_field}][]": value, locale: I18n.locale | ||
) | ||
path += '&include_child_works=true' if work["is_child_bsi"] == true | ||
value = CampusService.find(value)[:term] || '' if field_name == :campus | ||
"<a href='#{File.join(@base_url, path)}'>#{value}</a>" | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |