Module: CurationConcerns::PresentsAttributes

Included in:
CollectionPresenter, FileSetPresenter, WorkShowPresenter
Defined in:
app/presenters/curation_concerns/presents_attributes.rb

Instance Method Summary collapse

Instance Method Details

#attribute_to_html(field, options = {}) ⇒ Object

Present the attribute as an HTML table row.

Options Hash (options):

  • :catalog_search_link (true, false)

    return a link to a catalog search for that text if true

  • :search_field (String)

    If the method_name of the attribute is different than how the attribute name should appear on the search URL, you can explicitly set the URL’s search field name

  • :label (String)

    The default label for the field if no translation is found



12
13
14
15
# File 'app/presenters/curation_concerns/presents_attributes.rb', line 12

def attribute_to_html(field, options = {})
  return unless respond_to?(field)
  AttributeRenderer.new(field, send(field), options).render
end

#display_microdata?Boolean



25
26
27
# File 'app/presenters/curation_concerns/presents_attributes.rb', line 25

def display_microdata?
  CurationConcerns.config.display_microdata
end

#microdata_type_to_htmlObject



29
30
31
32
33
# File 'app/presenters/curation_concerns/presents_attributes.rb', line 29

def microdata_type_to_html
  return "" unless display_microdata?
  value = I18n.t(microdata_type_key, default: CurationConcerns.config.microdata_default_type)
  " itemscope itemtype=\"#{value}\"".html_safe
end

#permission_badgeObject



17
18
19
# File 'app/presenters/curation_concerns/presents_attributes.rb', line 17

def permission_badge
  permission_badge_class.new(solr_document).render
end

#permission_badge_classObject



21
22
23
# File 'app/presenters/curation_concerns/presents_attributes.rb', line 21

def permission_badge_class
  PermissionBadge
end