Sha256: 06c2770f0da434e3ee321400f4f86e5696a7923021f9daabdc730c07a5b4cefb

Contents?: true

Size: 1.31 KB

Versions: 26

Compression:

Stored size: 1.31 KB

Contents

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

    include Blacklight::Base
    include Spotlight::Config

    # 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/MethodLength, Metrics/AbcSize
    def autocomplete_json_response_for_document(doc)
      {
        id: doc.id,
        title: CGI.unescapeHTML(view_context.presenter(doc).document_heading.to_str),
        thumbnail: doc.first(blacklight_config.index.thumbnail_field),
        thumbnails: doc.spotlight_image_versions.try(:thumb) || doc[blacklight_config.index.thumbnail_field],
        full_image_url: doc.spotlight_image_versions.try(:full).try(:first),
        full_images: doc.spotlight_image_versions.try(:full),
        image_versions: doc.spotlight_image_versions.image_versions(:thumb, :full),
        description: doc.id,
        url: exhibit_catalog_path(current_exhibit, doc),
        private: doc.private?(current_exhibit),
        global_id: doc.to_global_id.to_s
      }
    end
    # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
blacklight-spotlight-0.17.1 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.17.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.16.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.15.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.14.2 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.14.1 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.14.0 lib/spotlight/base.rb
blacklight-spotlight-0.13.0 lib/spotlight/base.rb
blacklight-spotlight-0.12.1 lib/spotlight/base.rb
blacklight-spotlight-0.12.0 lib/spotlight/base.rb
blacklight-spotlight-0.11.0 lib/spotlight/base.rb
blacklight-spotlight-0.10.3 lib/spotlight/base.rb
blacklight-spotlight-0.10.2 lib/spotlight/base.rb
blacklight-spotlight-0.10.1 lib/spotlight/base.rb
blacklight-spotlight-0.10.0 lib/spotlight/base.rb
blacklight-spotlight-0.9.2 lib/spotlight/base.rb
blacklight-spotlight-0.9.1 lib/spotlight/base.rb
blacklight-spotlight-0.9.0 lib/spotlight/base.rb
blacklight-spotlight-0.8.2 lib/spotlight/base.rb
blacklight-spotlight-0.8.1 lib/spotlight/base.rb