Sha256: 4b1123fe40a4cc9694d47508d40155326019fc4c0a309df98dbc11fc135b92f9

Contents?: true

Size: 659 Bytes

Versions: 4

Compression:

Stored size: 659 Bytes

Contents

module Hyrax
  module ResourceTypesService
    mattr_accessor :authority
    self.authority = Qa::Authorities::Local.subauthority_for('resource_types')

    def self.select_options
      authority.all.map do |element|
        [element[:label], element[:id]]
      end
    end

    def self.label(id)
      authority.find(id).fetch('term')
    end

    # @param [String] id identifier of the resource type
    def self.microdata_type(id)
      return Hyrax.config.microdata_default_type if id.nil?
      I18n.t("#{Hyrax::Renderers::ConfiguredMicrodata::PREFIX}.resource_type.#{id}",
             default: Hyrax.config.microdata_default_type)
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
hyrax-1.0.1 app/services/hyrax/resource_types_service.rb
hyrax-1.0.0.rc2 app/services/hyrax/resource_types_service.rb
hyrax-1.0.0.rc1 app/services/hyrax/resource_types_service.rb
test_hyrax-0.0.1.alpha app/services/hyrax/resource_types_service.rb