Skip to content

Commit db0b29f

Browse files
committed
link relatedItem[@otherType] values to facet if configured (DLC-1144)
- replace deprecated field configuration key link_to_search with link_to_facet
1 parent c559373 commit db0b29f

File tree

15 files changed

+73
-23
lines changed

15 files changed

+73
-23
lines changed

app/controllers/iiif/presentations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Iiif::PresentationsController < ApplicationController
1313

1414
configure_blacklight do |config|
1515
Dcv::Configurators::DcvBlacklightConfigurator.configure(config)
16-
config.show_fields.each { |field_key, show_field| show_field.link_to_search = false }
16+
config.show_fields.each { |field_key, show_field| show_field.link_to_facet = false }
1717
end
1818

1919
layout false

app/helpers/field_display_helpers/name.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def display_names_with_roles(args={})
2929
field_config = blacklight_config.show_fields[args[:field]]
3030
end
3131

32-
default_field = field_config.link_to_search if blacklight_config.facet_fields[field_config.link_to_search]
32+
default_field = field_config.link_to_facet if blacklight_config.facet_fields[field_config.link_to_facet]
3333
names.map do |name, role_info|
3434
facet_field = role_info[:fields].detect { |field_name| blacklight_config.facet_fields[field_name]} || default_field
3535
value = (!args[:suppress_links] && facet_field) ?

app/helpers/field_display_helpers/project.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def show_digital_project?(field_config, document)
1010
end
1111

1212
def show_field_project_to_facet_link(args)
13-
return args[:document][args[:field]] unless blacklight_config.show_fields[args[:field]].link_to_search
13+
return args[:document][args[:field]] unless blacklight_config.show_fields[args[:field]].link_to_facet
1414
projects_config = Rails.application.config_for(:hyacinth_projects)
1515

1616
display_values = args[:document][args[:field]]

app/helpers/field_display_helpers/repository.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def show_field_repository_to_facet_link(args)
4949
facet_value = full_repo_names_to_short_repo_names[display_value]
5050
end
5151

52-
url_for_facet_search = search_action_path(:f => {facet_field_name => [facet_value]}) if blacklight_config.show_fields[args[:field]].link_to_search
52+
url_for_facet_search = search_action_path(:f => {facet_field_name => [facet_value]}) if blacklight_config.show_fields[args[:field]].link_to_facet
5353

5454
if display_value == 'Non-Columbia Location' && args[:document]['lib_repo_text_ssm'].present?
5555
result_src = [args[:document]['lib_repo_text_ssm'].first]

app/models/site.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class Site < ApplicationRecord
3131

3232
Dcv::Configurators::DcvBlacklightConfigurator.configure_show_fields(config)
3333
field_name = 'lib_repo_short_ssim'
34-
config.show_fields[field_name].link_to_search = false
34+
config.show_fields[field_name].link_to_facet = false
3535
field_name = 'lib_project_full_ssim'
36-
config.show_fields[field_name].link_to_search = false
36+
config.show_fields[field_name].link_to_facet = false
3737

3838
Dcv::Configurators::DcvBlacklightConfigurator.configure_citation_fields(config)
3939
Dcv::Configurators::DcvBlacklightConfigurator.configure_sort_fields(config)

app/presenters/dcv/field_presenter.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@ def label(context = 'index', **options)
1010
super
1111
end
1212
end
13+
def pipeline_steps
14+
upstream_operations = Blacklight::Rendering::Pipeline.operations.dup
15+
upstream_operations.index(Blacklight::Rendering::LinkToFacet)&.tap { |ix| upstream_operations[ix] = Rendering::LinkToFacet }
16+
(options[:steps] || field_config[:steps] || upstream_operations) - except_operations
17+
end
1318
end
1419
end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module Dcv
2+
module Rendering
3+
class LinkToFacet < Blacklight::Rendering::LinkToFacet
4+
def render
5+
return next_step(values) unless linkable_facet
6+
7+
next_step(render_link)
8+
end
9+
10+
def linkable_facet
11+
config.link_to_facet && context.blacklight_config.facet_fields[link_field]
12+
end
13+
end
14+
end
15+
end

lib/dcv/configurators/carnegie_blacklight_configurator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def self.configure(config, fulltext: true)
6363
# The ordering of the field names is the order of the display
6464
# solr fields to be displayed in the show (single result) view
6565
# The ordering of the field names is the order of the display
66-
config.add_show_field 'lib_name_ssm', label: 'Name', link_to_search: 'lib_name_sim', helper_method: :display_non_copyright_names_with_roles, if: :has_non_copyright_names?
66+
config.add_show_field 'lib_name_ssm', label: 'Name', link_to_facet: 'lib_name_sim', helper_method: :display_non_copyright_names_with_roles, if: :has_non_copyright_names?
6767
config.add_show_field 'title_display_ssm', label: 'Title'
6868
config.add_show_field 'abstract_ssm', label: 'Abstract', helper_method: :expandable_past_400
6969
config.add_show_field 'lib_collection_ssm', label: 'Collection Name', helper_method: :display_collection_with_links

lib/dcv/configurators/dcv_blacklight_configurator.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ def self.configure_index_fields(config)
113113
# The ordering of the field names is the order of the display
114114
def self.configure_show_fields(config)
115115
configure_file_show_fields(config)
116-
config.add_show_field 'lib_name_ssm', label: 'Name', link_to_search: 'lib_name_sim', helper_method: :display_non_copyright_names_with_roles, if: :has_non_copyright_names?
117-
config.add_show_field 'rel_other_project_ssim', :label => 'Project'
116+
config.add_show_field 'lib_name_ssm', label: 'Name', link_to_facet: 'lib_name_sim', helper_method: :display_non_copyright_names_with_roles, if: :has_non_copyright_names?
117+
config.add_show_field 'rel_other_project_ssim', label: 'Project', link_to_facet: true
118118
config.add_show_field 'title_display_ssm', label: 'Title'
119119
config.add_show_field 'alternative_title_ssm', :label => 'Other Titles'
120120
config.add_show_field 'abstract_ssm', label: 'Abstract', helper_method: :expandable_past_400, iiif: false
@@ -132,14 +132,14 @@ def self.configure_show_fields(config)
132132
config.add_show_field 'lib_date_textual_ssm', :label => 'Date', :helper_method => :show_date_field
133133
config.add_show_field 'physical_description_extent_ssm', :label => 'Physical Description'
134134
config.add_show_field 'dynamic_notes', pattern: /lib_.*_notes_ssm/, label: :notes_label, helper_method: :expandable_past_250, unless: :is_excepted_dynamic_field?, except: ['lib_acknowledgment_notes_ssm'], join: false
135-
config.add_show_field 'language_language_term_text_ssim', :label => 'Language', :link_to_search => 'language_language_term_text_ssim'
135+
config.add_show_field 'language_language_term_text_ssim', label: 'Language', link_to_facet: 'language_language_term_text_ssim'
136136
config.add_show_field 'table_of_contents_ssm', :label => 'Contents'
137-
config.add_show_field 'lib_repo_short_ssim', label: 'Library Location', helper_method: :show_field_repository_to_facet_link, link_to_search: true, iiif: false
137+
config.add_show_field 'lib_repo_short_ssim', label: 'Library Location', helper_method: :show_field_repository_to_facet_link, link_to_facet: true, iiif: false
138138
config.add_show_field 'location_sublocation_ssm', :label => 'Department'
139139
config.add_show_field 'clio_ssim', label: 'Catalog Record', helper_method: :render_link_to_clio, join: false
140140
config.add_show_field 'lib_part_ssm', :label => 'Part'
141-
config.add_show_field 'lib_project_full_ssim', label: 'Digital Project', helper_method: :show_field_project_to_facet_link, link_to_search: :project_key, if: :show_digital_project?, unless_fields: :project_key_ssim
142-
config.add_show_field 'project_key_ssim', label: 'Digital Project', helper_method: :show_field_project_to_facet_link, link_to_search: :project_key, if: :show_digital_project?
141+
config.add_show_field 'lib_project_full_ssim', label: 'Digital Project', helper_method: :show_field_project_to_facet_link, link_to_facet: :project_key, if: :show_digital_project?, unless_fields: :project_key_ssim
142+
config.add_show_field 'project_key_ssim', label: 'Digital Project', helper_method: :show_field_project_to_facet_link, link_to_facet: :project_key, if: :show_digital_project?
143143
config.add_show_field 'other_sites_data', :label => 'Also In', :helper_method => :show_link_to_other_site_home
144144
# Note: Do NOT show the access_condition field. See DCV-465 for explanation.
145145
#config.add_show_field 'access_condition_ssim', :label => 'Rights'

lib/dcv/configurators/jay_blacklight_configurator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def self.configure(config)
5959
config.add_show_field 'title_display_ssm', :label => 'Title'
6060
config.add_show_field 'alternative_title_ssm', :label => 'Alternative Titles'
6161
config.add_show_field 'lib_repo_full_ssim', :label => 'Library Location', :helper_method => :show_field_repository_to_facet_link
62-
config.add_show_field 'lib_name_ssm', label: 'Name', link_to_search: 'lib_name_sim', helper_method: :display_non_copyright_names_with_roles, if: :has_non_copyright_names?
62+
config.add_show_field 'lib_name_ssm', label: 'Name', link_to_facet: 'lib_name_sim', helper_method: :display_non_copyright_names_with_roles, if: :has_non_copyright_names?
6363
config.add_show_field 'lib_format_ssm', :label => 'Format'
6464
config.add_show_field 'lib_project_full_ssim', :label => 'Digital Project'
6565
config.add_show_field 'lib_collection_ssm', :label => 'Collection'

0 commit comments

Comments
 (0)