Sha256: 6eefb885fdde80281e0b8e2b290f7ee23d31d78b35451d0e086edd8ce9367957

Contents?: true

Size: 1.2 KB

Versions: 10

Compression:

Stored size: 1.2 KB

Contents

module CurationConcerns
  class FileSetPresenter
    include ModelProxy
    include PresentsAttributes
    attr_accessor :solr_document, :current_ability, :request

    # @param [SolrDocument] solr_document
    # @param [Ability] current_ability
    # @param [ActionDispatch::Request] request the http request context
    def initialize(solr_document, current_ability, request = nil)
      @solr_document = solr_document
      @current_ability = current_ability
      @request = request
    end

    # CurationConcern methods
    delegate :stringify_keys, :human_readable_type, :collection?, :image?, :video?,
             :audio?, :pdf?, :office_document?, :representative_id, :to_s, to: :solr_document

    # Methods used by blacklight helpers
    delegate :has?, :first, :fetch, to: :solr_document

    # Metadata Methods
    delegate :title, :label, :description, :creator, :contributor, :subject,
             :publisher, :language, :date_uploaded, :rights,
             :embargo_release_date, :lease_expiration_date,
             :depositor, :keyword, :title_or_label, to: :solr_document

    def page_title
      label
    end

    def link_name
      current_ability.can?(:read, id) ? label : 'File'
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
curation_concerns-1.1.2 app/presenters/curation_concerns/file_set_presenter.rb
curation_concerns-1.1.1 app/presenters/curation_concerns/file_set_presenter.rb
curation_concerns-1.1.0 app/presenters/curation_concerns/file_set_presenter.rb
curation_concerns-1.0.0 app/presenters/curation_concerns/file_set_presenter.rb
curation_concerns-1.0.0.beta10 app/presenters/curation_concerns/file_set_presenter.rb
curation_concerns-1.0.0.beta9 app/presenters/curation_concerns/file_set_presenter.rb
curation_concerns-1.0.0.beta8 app/presenters/curation_concerns/file_set_presenter.rb
curation_concerns-1.0.0.beta7 app/presenters/curation_concerns/file_set_presenter.rb
curation_concerns-1.0.0.beta6 app/presenters/curation_concerns/file_set_presenter.rb
curation_concerns-1.0.0.beta5 app/presenters/curation_concerns/file_set_presenter.rb