Sha256: 43e71ff82e2248e34e926ba5ec4c184a59d189c5ca8f3e99620befe4b7c5c15b

Contents?: true

Size: 1.34 KB

Versions: 24

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true

module Spotlight
  ##
  # Base controller mixin
  module Base
    extend ActiveSupport::Concern

    include Blacklight::Configurable
    include Blacklight::SearchContext
    include Spotlight::Config

    included do
      helper_method :controller_tracking_method
    end

    def controller_tracking_method
      Spotlight::Engine.config.controller_tracking_method
    end

    # This overwrites Blacklight::Configurable#blacklight_config
    def blacklight_config
      exhibit_specific_blacklight_config
    end

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

    # rubocop:disable Metrics/AbcSize
    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
    # rubocop:enable Metrics/AbcSize
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
blacklight-spotlight-4.3.6 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-4.3.5 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-4.3.4 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-4.3.3 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-4.3.2 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-4.3.1 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-4.3.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-4.2.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-4.1.2 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-4.1.1 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-4.1.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-4.0.3 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-4.0.2 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-4.0.1 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-4.0.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-3.6.0.beta10 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-3.6.0.beta9 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-3.6.0.beta8 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-3.6.0.beta7 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-3.6.0.beta6 app/controllers/concerns/spotlight/base.rb