Sha256: 780f72d6d9f4af7df0e87551b249f4f33ac04ba37cd2a7a25a6af1e38a43ba6d

Contents?: true

Size: 705 Bytes

Versions: 48

Compression:

Stored size: 705 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, nil] id identifier of the resource type
    #
    # @return [String] a schema.org type. Gives the default type if `id` is nil.
    def self.microdata_type(id)
      return Hyrax.config.microdata_default_type if id.nil?
      Microdata.fetch("resource_type.#{id}", default: Hyrax.config.microdata_default_type)
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/services/hyrax/resource_types_service.rb
hyrax-2.9.5 app/services/hyrax/resource_types_service.rb
hyrax-2.9.4 app/services/hyrax/resource_types_service.rb
hyrax-2.9.3 app/services/hyrax/resource_types_service.rb
hyrax-2.9.2 app/services/hyrax/resource_types_service.rb
hyrax-2.9.1 app/services/hyrax/resource_types_service.rb
hyrax-2.9.0 app/services/hyrax/resource_types_service.rb
hyrax-2.8.0 app/services/hyrax/resource_types_service.rb
hyrax-2.7.2 app/services/hyrax/resource_types_service.rb
hyrax-2.7.1 app/services/hyrax/resource_types_service.rb
hyrax-2.7.0 app/services/hyrax/resource_types_service.rb
hyrax-2.6.0 app/services/hyrax/resource_types_service.rb
hyrax-3.0.0.pre.rc1 app/services/hyrax/resource_types_service.rb
hyrax-3.0.0.pre.beta3 app/services/hyrax/resource_types_service.rb
hyrax-2.5.1 app/services/hyrax/resource_types_service.rb
hyrax-2.5.0 app/services/hyrax/resource_types_service.rb
hyrax-3.0.0.pre.beta2 app/services/hyrax/resource_types_service.rb
hyrax-2.4.1 app/services/hyrax/resource_types_service.rb
hyrax-3.0.0.pre.beta1 app/services/hyrax/resource_types_service.rb
hyrax-2.4.0 app/services/hyrax/resource_types_service.rb