Sha256: 30aa7999de82c8a8e42805563049942c792e57b2f519f7ea624c5e46f65d3d94

Contents?: true

Size: 938 Bytes

Versions: 6

Compression:

Stored size: 938 Bytes

Contents

module CurationConcerns
  class CollectionPresenter
    include ModelProxy
    include PresentsAttributes
    include ActionView::Helpers::NumberHelper
    attr_accessor :solr_document, :current_ability

    # @param [SolrDocument] solr_document
    # @param [Ability] current_ability
    def initialize(solr_document, current_ability)
      @solr_document = solr_document
      @current_ability = current_ability
    end

    # CurationConcern methods
    delegate :stringify_keys, :human_readable_type, :collection?, :representative_id,
             to: :solr_document

    # Metadata Methods
    delegate :title, :description, :creator, :contributor, :subject, :publisher, :language,
             :embargo_release_date, :lease_expiration_date, :rights, to: :solr_document

    def size
      number_to_human_size(@solr_document['bytes_is'])
    end

    def total_items
      @solr_document['member_ids_ssim'].length
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
curation_concerns-0.9.0 app/presenters/curation_concerns/collection_presenter.rb
curation_concerns-0.8.0 app/presenters/curation_concerns/collection_presenter.rb
curation_concerns-0.7.0 app/presenters/curation_concerns/collection_presenter.rb
curation_concerns-0.6.0 app/presenters/curation_concerns/collection_presenter.rb
curation_concerns-0.5.0 app/presenters/curation_concerns/collection_presenter.rb
curation_concerns-0.4.0 app/presenters/curation_concerns/collection_presenter.rb