Module: Spotlight::Catalog

Extended by:
ActiveSupport::Concern
Includes:
Base, SearchHelper
Included in:
BrowseController, CatalogController, HomePagesController
Defined in:
app/controllers/concerns/spotlight/catalog.rb

Overview

Spotlight catalog mixins

Instance Method Summary collapse

Methods included from SearchHelper

#search_service, #search_service_context

Methods included from Base

#autocomplete_json_response, #autocomplete_json_response_for_document, #blacklight_config, #controller_tracking_method

Methods included from Config

#exhibit_specific_blacklight_config

Instance Method Details

#add_facet_visibility_fieldObject

Adds a facet to display document visibility for the current exhibit if the user is a curator rubocop:disable Metrics/MethodLength



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/concerns/spotlight/catalog.rb', line 18

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

#render_curator_actions?Boolean

rubocop:enable Metrics/MethodLength

Returns:

  • (Boolean)


36
37
38
39
# File 'app/controllers/concerns/spotlight/catalog.rb', line 36

def render_curator_actions?
  (current_exhibit && can?(:curate, current_exhibit)) &&
    !(params[:controller] == 'spotlight/catalog' && params[:action] == 'admin')
end