Class: Sufia::CollectionPresenter

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

Direct Known Subclasses

AdminSetPresenter

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



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

def self.terms
  [:total_items, :size, :resource_type, :creator, :contributor, :keyword,
   :rights, :publisher, :date_created, :subject, :language, :identifier,
   :based_near, :related_url]
end

Instance Method Details

#[](key) ⇒ Object



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

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

#terms_with_valuesObject



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

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