Class: Sufia::TrophyPresenter
- Inherits:
-
Object
- Object
- Sufia::TrophyPresenter
- Includes:
- CurationConcerns::ModelProxy
- Defined in:
- app/presenters/sufia/trophy_presenter.rb
Instance Attribute Summary collapse
-
#solr_document ⇒ Object
readonly
Returns the value of attribute solr_document.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(solr_document) ⇒ TrophyPresenter
constructor
A new instance of TrophyPresenter.
- #thumbnail_path ⇒ Object
Constructor Details
#initialize(solr_document) ⇒ TrophyPresenter
4 5 6 |
# File 'app/presenters/sufia/trophy_presenter.rb', line 4 def initialize(solr_document) @solr_document = solr_document end |
Instance Attribute Details
#solr_document ⇒ Object (readonly)
Returns the value of attribute solr_document.
8 9 10 |
# File 'app/presenters/sufia/trophy_presenter.rb', line 8 def solr_document @solr_document end |
Class Method Details
.find_by_user(user) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/presenters/sufia/trophy_presenter.rb', line 12 def self.find_by_user(user) work_ids = user.trophies.pluck(:work_id) query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids(work_ids) results = CurationConcerns::WorkRelation.new.search_with_conditions(query) results.map { |result| TrophyPresenter.new(document_model.new(result)) } rescue RSolr::Error::ConnectionRefused [] end |
Instance Method Details
#thumbnail_path ⇒ Object
21 22 23 |
# File 'app/presenters/sufia/trophy_presenter.rb', line 21 def thumbnail_path solr_document[CatalogController.blacklight_config.index.thumbnail_field] end |