Sha256: 0cd6f4df395dc5260b8999b6a808ed025511eef48c6b9e765c04278ab5870ab9

Contents?: true

Size: 1.08 KB

Versions: 27

Compression:

Stored size: 1.08 KB

Contents

module CurationConcerns
  module ConfiguredMicrodata
    def microdata?(field)
      return false unless CurationConcerns.config.display_microdata
      key = "curation_concerns.schema_org.#{field}.property"
      t(key, default: false)
    end

    def microdata_object?(field)
      return false unless CurationConcerns.config.display_microdata
      key = "curation_concerns.schema_org.#{field}.type"
      t(key, default: false)
    end

    def microdata_object_attributes(field)
      if microdata_object?(field)
        { itemprop: microdata_property(field), itemscope: '', itemtype: microdata_type(field) }
      else
        {}
      end
    end

    def microdata_property(field)
      t("curation_concerns.schema_org.#{field}.property")
    end

    def microdata_type(field)
      t("curation_concerns.schema_org.#{field}.type")
    end

    def microdata_value_attributes(field)
      if microdata?(field)
        key = microdata_object?(field) ? :value : :property
        { itemprop: t("curation_concerns.schema_org.#{field}.#{key}") }
      else
        {}
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
curation_concerns-1.0.0.beta1 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.14.0 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.14.0.pre4 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.14.0.pre3 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.14.0.pre2 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.14.0.pre1 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.13.1 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.13.0 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.12.0 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.12.0.pre9 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.12.0.pre8 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.12.0.pre7 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.12.0.pre6 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.12.0.pre5 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.12.0.pre4 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.12.0.pre3 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.12.0.pre2 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.12.0.pre1 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.11.0 app/renderers/curation_concerns/configured_microdata.rb
curation_concerns-0.11.0.rc1 app/renderers/curation_concerns/configured_microdata.rb