Sha256: b196065b86ce1497aa6378ffe2a4b40204ba98674305b9d9317f830586a2b66c

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

# frozen_string_literal: true

module Blacklight
  module Document
    class CitationComponent < ::ViewComponent::Base
      DEFAULT_FORMATS = {
        'blacklight.citation.mla': :export_as_mla_citation_txt,
        'blacklight.citation.apa': :export_as_apa_citation_txt,
        'blacklight.citation.chicago': :export_as_chicago_citation_txt
      }.freeze

      with_collection_parameter :document

      def initialize(document:, formats: DEFAULT_FORMATS)
        @document = document
        @formats = formats.select { |_k, v| @document.respond_to?(v) }
      end

      def title
        @view_context.document_heading(@document)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-7.11.1 app/components/blacklight/document/citation_component.rb