Sha256: df82f11f05ef7bcda7a0ce74176cb71edc7607d1f0d788261a895dcd7115aab0

Contents?: true

Size: 771 Bytes

Versions: 8

Compression:

Stored size: 771 Bytes

Contents

module Sufia
  class CollectionPresenter < CurationConcerns::CollectionPresenter
    delegate :resource_type, :based_near, :related_url, :identifier, to: :solr_document

    # Terms is the list of fields displayed by app/views/collections/_show_descriptions.html.erb
    def self.terms
      [:title, :total_items, :size, :resource_type, :description, :creator,
       :contributor, :keyword, :rights, :publisher, :date_created, :subject,
       :language, :identifier, :based_near, :related_url]
    end

    def terms_with_values
      self.class.terms.select { |t| self[t].present? }
    end

    def [](key)
      case key
      when :size
        size
      when :total_items
        total_items
      else
        solr_document.send key
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sufia-7.1.0 app/presenters/sufia/collection_presenter.rb
sufia-7.0.0 app/presenters/sufia/collection_presenter.rb
sufia-7.0.0.rc2 app/presenters/sufia/collection_presenter.rb
sufia-7.0.0.rc1 app/presenters/sufia/collection_presenter.rb
sufia-7.0.0.beta4 app/presenters/sufia/collection_presenter.rb
sufia-7.0.0.beta3 app/presenters/sufia/collection_presenter.rb
sufia-7.0.0.beta2 app/presenters/sufia/collection_presenter.rb
sufia-7.0.0.beta1 app/presenters/sufia/collection_presenter.rb