Module: Spotlight::Concerns::ApplicationController

Extended by:
ActiveSupport::Concern
Includes:
Spotlight::Controller
Included in:
ApplicationController, Spotlight::CatalogController
Defined in:
app/controllers/spotlight/concerns/application_controller.rb

Overview

Inherit from the host app’s ApplicationController This will configure e.g. the layout used by the host

Instance Method Summary collapse

Methods included from Spotlight::Controller

#blacklight_config, #current_exhibit, #current_masthead, #current_masthead=, #current_site, #default_url_options, #exhibit_masthead?, #exhibit_search_action_url, #exhibit_search_facet_path, #resource_masthead?, #search_action_url, #search_facet_path, #search_state, #set_exhibit_locale_scope, #set_locale

Methods included from Spotlight::Config

#exhibit_specific_blacklight_config

Instance Method Details

#enabled_in_spotlight_view_type_configuration?(config, *args) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
35
36
37
38
39
40
# File 'app/controllers/spotlight/concerns/application_controller.rb', line 32

def enabled_in_spotlight_view_type_configuration?(config, *args)
  if config.respond_to?(:original) && !blacklight_configuration_context.evaluate_if_unless_configuration(config.original, *args)
    false
  elsif current_exhibit.nil? || is_a?(Spotlight::PagesController)
    true
  else
    current_exhibit.blacklight_configuration.document_index_view_types.include? config.key.to_s
  end
end

#field_enabled?(field, *args) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'app/controllers/spotlight/concerns/application_controller.rb', line 42

def field_enabled?(field, *args)
  if !field.enabled
    false
  elsif field.respond_to?(:original) && !blacklight_configuration_context.evaluate_if_unless_configuration(field.original, *args)
    false
  elsif field.is_a?(Blacklight::Configuration::SortField) || field.is_a?(Blacklight::Configuration::SearchField)
    field.enabled
  elsif field.is_a?(Blacklight::Configuration::FacetField) || (is_a?(Blacklight::Catalog) && %w[edit show].include?(action_name))
    field.show
  else
    field.send(document_index_view_type)
  end
end