Sha256: a866c316929c3ac9d903753fb575de16dd30cdafb7e3d429f6f685a94c46314d

Contents?: true

Size: 743 Bytes

Versions: 8

Compression:

Stored size: 743 Bytes

Contents

# frozen_string_literal: true
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.DATE_ISSUED, nil)
      end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
geoblacklight-4.0.0 app/models/concerns/geoblacklight/solr_document/citation.rb
geoblacklight-4.0.0.pre.rc3 app/models/concerns/geoblacklight/solr_document/citation.rb
geoblacklight-4.0.0.pre.rc2 app/models/concerns/geoblacklight/solr_document/citation.rb
geoblacklight-4.0.0.pre.rc1 app/models/concerns/geoblacklight/solr_document/citation.rb
geoblacklight-4.0.0.pre.alpha.3 app/models/concerns/geoblacklight/solr_document/citation.rb
geoblacklight-4.0.0.pre.alpha.2 app/models/concerns/geoblacklight/solr_document/citation.rb
geoblacklight-4.0.0.pre.alpha.1 app/models/concerns/geoblacklight/solr_document/citation.rb
geoblacklight-4.0.0.pre.alpha app/models/concerns/geoblacklight/solr_document/citation.rb