Module: Hyrax::PresentsAttributes
- Included in:
- CollectionPresenter, FileSetPresenter, WorkShowPresenter
- Defined in:
- app/presenters/hyrax/presents_attributes.rb
Instance Method Summary collapse
-
#attribute_to_html(field, options = {}) ⇒ Object
Present the attribute as an HTML table row or dl row.
- #display_microdata? ⇒ Boolean
- #microdata_type_to_html ⇒ Object
- #permission_badge ⇒ Object
- #permission_badge_class ⇒ Object
Instance Method Details
#attribute_to_html(field, options = {}) ⇒ Object
Present the attribute as an HTML table row or dl row.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/presenters/hyrax/presents_attributes.rb', line 16 def attribute_to_html(field, = {}) unless respond_to?(field) Hyrax.logger.warn("#{self.class} attempted to render #{field}, but no method exists with that name.") return end if [:html_dl] renderer_for(field, ).new(field, send(field), ).render_dl_row else renderer_for(field, ).new(field, send(field), ).render end end |
#display_microdata? ⇒ Boolean
37 38 39 |
# File 'app/presenters/hyrax/presents_attributes.rb', line 37 def display_microdata? Hyrax.config.display_microdata? end |
#microdata_type_to_html ⇒ Object
41 42 43 44 45 |
# File 'app/presenters/hyrax/presents_attributes.rb', line 41 def microdata_type_to_html return "" unless display_microdata? value = Microdata.fetch(microdata_type_key, default: Hyrax.config.microdata_default_type) " itemscope itemtype=\"#{value}\"".html_safe end |
#permission_badge ⇒ Object
29 30 31 |
# File 'app/presenters/hyrax/presents_attributes.rb', line 29 def .new(solr_document.visibility).render end |
#permission_badge_class ⇒ Object
33 34 35 |
# File 'app/presenters/hyrax/presents_attributes.rb', line 33 def PermissionBadge end |