Sha256: 9c0e05cf32e787a81dfeb583a212063838afa61c581998a443745f4b48794d78

Contents?: true

Size: 574 Bytes

Versions: 25

Compression:

Stored size: 574 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  module HumanReadableType
    extend ActiveSupport::Concern

    module ClassMethods
      def human_readable_type
        I18n.translate("activefedora.models.#{model_name.i18n_key}", default: name.demodulize.titleize)
      end
    end

    def human_readable_type
      self.class.human_readable_type
    end

    def to_solr(solr_doc = {})
      super(solr_doc).tap do |doc|
        doc["human_readable_type_sim"] = human_readable_type
        doc["human_readable_type_tesim"] = human_readable_type
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
hyrax-5.0.1 app/models/concerns/hyrax/human_readable_type.rb
hyrax-5.0.0 app/models/concerns/hyrax/human_readable_type.rb
hyrax-5.0.0.rc3 app/models/concerns/hyrax/human_readable_type.rb
hyrax-5.0.0.rc2 app/models/concerns/hyrax/human_readable_type.rb
hyrax-5.0.0.rc1 app/models/concerns/hyrax/human_readable_type.rb
hyrax-3.6.0 app/models/concerns/hyrax/human_readable_type.rb
hyrax-4.0.0 app/models/concerns/hyrax/human_readable_type.rb
hyrax-4.0.0.rc3 app/models/concerns/hyrax/human_readable_type.rb
hyrax-4.0.0.rc2 app/models/concerns/hyrax/human_readable_type.rb
hyrax-4.0.0.rc1 app/models/concerns/hyrax/human_readable_type.rb
hyrax-3.5.0 app/models/concerns/hyrax/human_readable_type.rb
hyrax-4.0.0.beta2 app/models/concerns/hyrax/human_readable_type.rb
hyrax-3.4.2 app/models/concerns/hyrax/human_readable_type.rb
hyrax-4.0.0.beta1 app/models/concerns/hyrax/human_readable_type.rb
hyrax-3.4.1 app/models/concerns/hyrax/human_readable_type.rb
hyrax-3.4.0 app/models/concerns/hyrax/human_readable_type.rb
hyrax-3.3.0 app/models/concerns/hyrax/human_readable_type.rb
hyrax-3.2.0 app/models/concerns/hyrax/human_readable_type.rb
hyrax-3.1.0 app/models/concerns/hyrax/human_readable_type.rb
hyrax-3.0.2 app/models/concerns/hyrax/human_readable_type.rb