Sha256: d41423784dc48a9e5016e563cb67d52c31f47a04bc6b2f114d34414f19c0a9f1

Contents?: true

Size: 1.3 KB

Versions: 25

Compression:

Stored size: 1.3 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).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: polymorphic_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

25 entries across 25 versions & 1 rubygems

Version Path
blacklight-spotlight-0.32.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.31.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.30.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.29.1 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.29.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.28.3 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.28.2 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.28.1 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.28.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.27.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.26.1 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.26.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.25.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.24.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.23.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.22.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.21.0 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.20.3 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.20.2 app/controllers/concerns/spotlight/base.rb
blacklight-spotlight-0.20.1 app/controllers/concerns/spotlight/base.rb