Module: Hyrax::CitationsBehaviors::PublicationBehavior
Instance Method Summary
collapse
#clean_end_punctuation, #persistent_url
Instance Method Details
#setup_pub_date(work) ⇒ Object
5
6
7
8
9
10
11
12
13
|
# File 'app/helpers/hyrax/citations_behaviors/publication_behavior.rb', line 5
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
|
#setup_pub_info(work, include_date = false) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/helpers/hyrax/citations_behaviors/publication_behavior.rb', line 24
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
|
#setup_pub_place(work_presenter) ⇒ Object
16
17
18
|
# File 'app/helpers/hyrax/citations_behaviors/publication_behavior.rb', line 16
def setup_pub_place(work_presenter)
work_presenter.based_near_label.first if work_presenter.based_near_label
end
|
#setup_pub_publisher(work) ⇒ Object
20
21
22
|
# File 'app/helpers/hyrax/citations_behaviors/publication_behavior.rb', line 20
def setup_pub_publisher(work)
work.publisher.first if work.publisher
end
|