Sha256: 6c8cc404cbdbe880387d565c913f5021af30ef5dd8b58acb7ca1f11654997c2f

Contents?: true

Size: 713 Bytes

Versions: 1

Compression:

Stored size: 713 Bytes

Contents

module Geoblacklight
  module SolrDocument
    module Citation
      include ActionView::Helpers::OutputSafetyHelper

      def geoblacklight_citation(solr_document_url)
        [
          fetch(Settings.FIELDS.CREATOR, nil),
          ("(#{issued})" if issued),
          fetch(Settings.FIELDS.TITLE, nil),
          ("[#{format}]" if format),
          fetch(Settings.FIELDS.PUBLISHER, nil),
          I18n.t('geoblacklight.citation.retrieved_from', document_url: solr_document_url)
        ].flatten.compact.join('. ')
      end

      private

      def issued
        fetch(Settings.FIELDS.ISSUED, nil)
      end

      def format
        fetch(Settings.FIELDS.FILE_FORMAT, nil)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
geoblacklight-2.4.0 app/models/concerns/geoblacklight/solr_document/citation.rb