Sha256: fec12ca0ee3cb9337219379f08ecc14e96866f1b42aed06340d780d2e60e0ba1

Contents?: true

Size: 1.25 KB

Versions: 19

Compression:

Stored size: 1.25 KB

Contents

module Hyrax
  module CitationsBehaviors
    module PublicationBehavior
      include Hyrax::CitationsBehaviors::CommonBehavior
      def setup_pub_date(work)
        first_date = work.date_created.first if work.date_created
        if first_date.present?
          first_date = CGI.escapeHTML(first_date)
          date_value = first_date.gsub(/[^0-9|n\.d\.]/, "")[0, 4]
          return nil if date_value.nil?
        end
        clean_end_punctuation(date_value) if date_value
      end

      # @param [Hyrax::WorkShowPresenter] work_presenter
      def setup_pub_place(work_presenter)
        work_presenter.based_near_label.first if work_presenter.based_near_label
      end

      def setup_pub_publisher(work)
        work.publisher.first if work.publisher
      end

      def setup_pub_info(work, include_date = false)
        pub_info = ""
        if (place = setup_pub_place(work))
          pub_info << CGI.escapeHTML(place)
        end
        if (publisher = setup_pub_publisher(work))
          pub_info << ": " << CGI.escapeHTML(publisher)
        end

        pub_date = include_date ? setup_pub_date(work) : nil
        pub_info << ", " << pub_date unless pub_date.nil?

        pub_info.strip!
        pub_info.blank? ? nil : pub_info
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
hyrax-2.0.3 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.1.0 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.1.0.rc4 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.1.0.rc3 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.1.0.rc2 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.1.0.rc1 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.1.0.beta2 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.0.2 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.1.0.beta1 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.0.1 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.0.0 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.0.0.rc3 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.0.0.rc2 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.0.0.rc1 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.0.0.beta5 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.0.0.beta4 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.0.0.beta3 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.0.0.beta2 app/helpers/hyrax/citations_behaviors/publication_behavior.rb
hyrax-2.0.0.beta1 app/helpers/hyrax/citations_behaviors/publication_behavior.rb