Sha256: f9bd9a206f946fa05c6c1cd052fceb2363aba1b76a27daec7a5693e9b79608ba

Contents?: true

Size: 652 Bytes

Versions: 10

Compression:

Stored size: 652 Bytes

Contents

module Hyrax
  class SelectTypePresenter
    def initialize(concern)
      @concern = concern
    end

    attr_reader :concern

    def icon_class
      ModelIcon.css_class_for(concern)
    end

    def description
      translate('description')
    end

    def name
      translate('name')
    end

    private

      def object_name
        @object_name ||= concern.model_name.i18n_key
      end

      def translate(key)
        defaults = []
        defaults << :"hyrax.select_type.#{object_name}.#{key}"
        defaults << :"hyrax.select_type.#{key}"
        defaults << ''
        I18n.t(defaults.shift, default: defaults)
      end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
hyrax-1.1.1 app/presenters/hyrax/select_type_presenter.rb
hyrax-1.1.0 app/presenters/hyrax/select_type_presenter.rb
hyrax-1.0.5 app/presenters/hyrax/select_type_presenter.rb
hyrax-1.0.4 app/presenters/hyrax/select_type_presenter.rb
hyrax-1.0.3 app/presenters/hyrax/select_type_presenter.rb
hyrax-1.0.2 app/presenters/hyrax/select_type_presenter.rb
hyrax-1.0.1 app/presenters/hyrax/select_type_presenter.rb
hyrax-1.0.0.rc2 app/presenters/hyrax/select_type_presenter.rb
hyrax-1.0.0.rc1 app/presenters/hyrax/select_type_presenter.rb
test_hyrax-0.0.1.alpha app/presenters/hyrax/select_type_presenter.rb