Module: Spotlight::Base

Extended by:
ActiveSupport::Concern
Includes:
Blacklight::Configurable, Blacklight::SearchContext, Config
Included in:
Catalog, DashboardsController, PagesController, SearchesController
Defined in:
app/controllers/concerns/spotlight/base.rb

Overview

Base controller mixin

Instance Method Summary collapse

Methods included from Config

#exhibit_specific_blacklight_config

Instance Method Details

#autocomplete_json_response(document_list) ⇒ Object



26
27
28
29
30
# File 'app/controllers/concerns/spotlight/base.rb', line 26

def autocomplete_json_response(document_list)
  document_list.map do |doc|
    autocomplete_json_response_for_document doc
  end
end

#autocomplete_json_response_for_document(doc) ⇒ Object

rubocop:disable Metrics/AbcSize



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/concerns/spotlight/base.rb', line 33

def autocomplete_json_response_for_document(doc)
  {
    id: doc.id,
    title: CGI.unescapeHTML(view_context.document_presenter(doc).heading.to_str),
    thumbnail: doc.first(blacklight_config.index.thumbnail_field),
    full_image_url: doc.first(Spotlight::Engine.config.full_image_field),
    description: doc.id,
    url: polymorphic_path([current_exhibit, doc]),
    private: doc.private?(current_exhibit),
    global_id: doc.to_global_id.to_s,
    iiif_manifest: doc[Spotlight::Engine.config.iiif_manifest_field]
  }
end

#blacklight_configObject

This overwrites Blacklight::Configurable#blacklight_config



22
23
24
# File 'app/controllers/concerns/spotlight/base.rb', line 22

def blacklight_config
  exhibit_specific_blacklight_config
end

#controller_tracking_methodObject



17
18
19
# File 'app/controllers/concerns/spotlight/base.rb', line 17

def controller_tracking_method
  Spotlight::Engine.config.controller_tracking_method
end