Class: Sufia::CollectionPresenter

Inherits:
CurationConcerns::CollectionPresenter
  • Object
show all
Defined in:
app/presenters/sufia/collection_presenter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.termsObject

Terms is the list of fields displayed by app/views/collections/_show_descriptions.html.erb



6
7
8
9
10
# File 'app/presenters/sufia/collection_presenter.rb', line 6

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

Instance Method Details

#[](key) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'app/presenters/sufia/collection_presenter.rb', line 16

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

#terms_with_valuesObject



12
13
14
# File 'app/presenters/sufia/collection_presenter.rb', line 12

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