diff --git a/app/controllers/catalog_controller.rb b/app/controllers/catalog_controller.rb index 19eb71c8e9..008605c8bf 100644 --- a/app/controllers/catalog_controller.rb +++ b/app/controllers/catalog_controller.rb @@ -88,6 +88,8 @@ class CatalogController < ApplicationController config.add_facet_field 'collection_ssim', label: 'Collection', limit: 5 config.add_facet_field 'unit_ssim', label: 'Unit', limit: 5 config.add_facet_field 'language_ssim', label: 'Language', limit: 5 + config.add_facet_field 'rights_statement_ssi', label: 'Rights Statement', limit: 5, helper_method: :rights_statement_facet_display + # Hide these facets if not a Collection Manager config.add_facet_field 'workflow_published_sim', label: 'Published', limit: 5, if: Proc.new {|context, config, opts| context.current_ability.can? :create, MediaObject}, group: "workflow" config.add_facet_field 'avalon_uploader_ssi', label: 'Created by', limit: 5, if: Proc.new {|context, config, opts| context.current_ability.can? :create, MediaObject}, group: "workflow" diff --git a/app/helpers/blacklight/local_blacklight_helper.rb b/app/helpers/blacklight/local_blacklight_helper.rb index 10cde5281e..e7284efd74 100644 --- a/app/helpers/blacklight/local_blacklight_helper.rb +++ b/app/helpers/blacklight/local_blacklight_helper.rb @@ -25,6 +25,10 @@ def facet_group_names blacklight_config.facet_fields.map {|facet,opts| opts[:group]}.uniq end + def rights_statement_facet_display arg + ModsDocument::RIGHTS_STATEMENTS[arg] + end + def contributor_index_display args args[:document][args[:field]].first(3).join("; ") end diff --git a/spec/controllers/catalog_controller_spec.rb b/spec/controllers/catalog_controller_spec.rb index 47ed27d264..ce133a55ba 100644 --- a/spec/controllers/catalog_controller_spec.rb +++ b/spec/controllers/catalog_controller_spec.rb @@ -263,7 +263,7 @@ MediaObjectIndexingJob.perform_now(media_object.id) end ["avalon_resource_type_ssim", "creator_ssim", "date_sim", "genre_ssim", "series_ssim", "collection_ssim", "unit_ssim", "language_ssim", "has_captions_bsi", "has_transcripts_bsi", - "workflow_published_sim", "avalon_uploader_ssi", "read_access_group_ssim", "read_access_virtual_group_ssim", "date_digitized_ssim", "date_ingested_ssim", "subject_ssim"].each do |field| + "workflow_published_sim", "avalon_uploader_ssi", "read_access_group_ssim", "read_access_virtual_group_ssim", "date_digitized_ssim", "date_ingested_ssim", "subject_ssim", "rights_statement_ssi"].each do |field| it "should facet results on #{field}" do query = Array(media_object.to_solr(include_child_fields:true)[field]).first # The following line is to check that the test is using a valid solr field name diff --git a/spec/features/capybara_catalog_spec.rb b/spec/features/capybara_catalog_spec.rb index d094b0464c..bcc543bb32 100644 --- a/spec/features/capybara_catalog_spec.rb +++ b/spec/features/capybara_catalog_spec.rb @@ -32,6 +32,7 @@ expect(page).to have_selector(:id, "facet-#{field}_ssim-header") end expect(page).to have_selector(:id, "facet-date_sim-header") + expect(page).to have_selector(:id, "facet-rights_statement_ssi-header") ['workflow_published_sim', 'avalon_uploader_ssi', 'read_access_group_ssim', 'read_access_virtual_group_ssim', 'date_digitized_ssim', 'date_ingested_ssim'].each do |field| expect(page).to_not have_selector(:id, "facet-#{field}-header") end