Sha256: 17964c4e1c996cd75b0e1791ce5fbad5b3a998004df7df23ee57b371f9cb9fba
Contents?: true
Size: 896 Bytes
Versions: 46
Compression:
Stored size: 896 Bytes
Contents
module Hyrax class TrophyPresenter include ModelProxy def initialize(solr_document) @solr_document = solr_document end attr_reader :solr_document delegate :to_s, :thumbnail_path, to: :solr_document # @param user [User] the user to find the TrophyPresentes for. # @return [Array<TrophyPresenter>] a list of all the trophy presenters for the user def self.find_by_user(user) work_ids = user.trophies.pluck(:work_id) query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids(work_ids) results = Hyrax::WorkRelation.new.search_with_conditions(query) results.map { |result| TrophyPresenter.new(document_model.new(result)) } rescue RSolr::Error::ConnectionRefused [] end def self.document_model CatalogController.blacklight_config.document_model end private_class_method :document_model end end
Version data entries
46 entries across 46 versions & 1 rubygems