Module: ApplicationHelper

Defined in:
app/helpers/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#ark_url(ark_value) ⇒ Object



25
26
27
28
29
# File 'app/helpers/application_helper.rb', line 25

def ark_url(ark_value)
  return nil if ark_value.blank?
  # This was originally in Work#ark_url as: "https://ezid.cdlib.org/id/#{ark}"
  "http://arks.princeton.edu/#{ark_value}"
end

#doi_url(doi_value) ⇒ Object



31
32
33
34
# File 'app/helpers/application_helper.rb', line 31

def doi_url(doi_value)
  return nil if doi_value.blank?
  "#{Rails.configuration.datacite.doi_url}#{doi_value}"
end

#flash_noticeObject



10
11
12
13
14
15
# File 'app/helpers/application_helper.rb', line 10

def flash_notice
  value = flash[:notice]
  # rubocop:disable Rails/OutputSafety
  value.html_safe
  # rubocop:enable Rails/OutputSafety
end

#html_tag_attributesHash

Attributes to add to the tag (e.g. lang and dir)

Returns:

  • (Hash)


6
7
8
# File 'app/helpers/application_helper.rb', line 6

def html_tag_attributes
  { lang: I18n.locale }
end

#pre_curation_uploads_file_name(file:) ⇒ Object Also known as: post_curation_uploads_file_name



17
18
19
20
21
22
# File 'app/helpers/application_helper.rb', line 17

def pre_curation_uploads_file_name(file:)
  value = file.filename.to_s
  return if value.blank?

  value[0..79]
end