Sha256: 949066244a658b351535d9eb760a15bcbcd40c122785c15f0e60fdeefb29d460
Contents?: true
Size: 1.67 KB
Versions: 50
Compression:
Stored size: 1.67 KB
Contents
# frozen_string_literal: true module Spotlight ## # Spotlight catalog mixins module Catalog extend ActiveSupport::Concern include Spotlight::Base include Spotlight::SearchHelper included do before_action :add_facet_visibility_field end # Adds a facet to display document visibility for the current exhibit # if the user is a curator # rubocop:disable Metrics/MethodLength def add_facet_visibility_field return unless current_exhibit && can?(:curate, current_exhibit) blacklight_config.add_facet_field 'exhibit_visibility', label: I18n.t(:'spotlight.catalog.facets.exhibit_visibility.label'), query: { public: { label: I18n.t(:'spotlight.catalog.facets.exhibit_visibility.public'), fq: "-#{blacklight_config.document_model.visibility_field(current_exhibit)}:false" }, private: { label: I18n.t(:'spotlight.catalog.facets.exhibit_visibility.private'), fq: "#{blacklight_config.document_model.visibility_field(current_exhibit)}:false" } } end # rubocop:enable Metrics/MethodLength def render_curator_actions? (current_exhibit && can?(:curate, current_exhibit)) && !(params[:controller] == 'spotlight/catalog' && params[:action] == 'admin') end end end
Version data entries
50 entries across 50 versions & 1 rubygems