Module: Spotlight::Base

Extended by:
ActiveSupport::Concern
Includes:
Blacklight::Base, Config
Included in:
BrowseController, 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



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

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/MethodLength, Metrics/AbcSize



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/concerns/spotlight/base.rb', line 24

def autocomplete_json_response_for_document(doc)
  {
    id: doc.id,
    title: CGI.unescapeHTML(view_context.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



13
14
15
# File 'app/controllers/concerns/spotlight/base.rb', line 13

def blacklight_config
  exhibit_specific_blacklight_config
end