Module: Hyrax::Renderers::ConfiguredMicrodata
- Included in:
- AttributeRenderer
- Defined in:
- app/renderers/hyrax/renderers/configured_microdata.rb
Overview
Instance Method Summary collapse
- #microdata?(field) ⇒ Boolean
- #microdata_object?(field) ⇒ Boolean
- #microdata_object_attributes(field) ⇒ Object
- #microdata_property(field) ⇒ Object
- #microdata_type(field) ⇒ Object
- #microdata_value_attributes(field) ⇒ Object
Instance Method Details
#microdata?(field) ⇒ Boolean
5 6 7 8 |
# File 'app/renderers/hyrax/renderers/configured_microdata.rb', line 5 def microdata?(field) return false unless Hyrax.config.display_microdata? translate_microdata(field: field, field_context: 'property', default: false) end |
#microdata_object?(field) ⇒ Boolean
10 11 12 13 |
# File 'app/renderers/hyrax/renderers/configured_microdata.rb', line 10 def microdata_object?(field) return false unless Hyrax.config.display_microdata? translate_microdata(field: field, field_context: 'type', default: false) end |
#microdata_object_attributes(field) ⇒ Object
15 16 17 18 19 20 21 |
# File 'app/renderers/hyrax/renderers/configured_microdata.rb', line 15 def microdata_object_attributes(field) if microdata_object?(field) { itemprop: microdata_property(field), itemscope: '', itemtype: microdata_type(field) } else {} end end |
#microdata_property(field) ⇒ Object
23 24 25 |
# File 'app/renderers/hyrax/renderers/configured_microdata.rb', line 23 def microdata_property(field) translate_microdata(field: field, field_context: 'property') end |
#microdata_type(field) ⇒ Object
27 28 29 |
# File 'app/renderers/hyrax/renderers/configured_microdata.rb', line 27 def microdata_type(field) translate_microdata(field: field, field_context: 'type') end |
#microdata_value_attributes(field) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'app/renderers/hyrax/renderers/configured_microdata.rb', line 31 def microdata_value_attributes(field) if microdata?(field) field_context = microdata_object?(field) ? :value : :property { itemprop: translate_microdata(field: field, field_context: field_context) } else {} end end |