Class: CurationConcerns::FileSetPresenter
- Inherits:
-
Object
- Object
- CurationConcerns::FileSetPresenter
- Includes:
- CharacterizationBehavior, ModelProxy, PresentsAttributes
- Defined in:
- app/presenters/curation_concerns/file_set_presenter.rb
Instance Attribute Summary collapse
-
#current_ability ⇒ Object
Returns the value of attribute current_ability.
-
#request ⇒ Object
Returns the value of attribute request.
-
#solr_document ⇒ Object
Returns the value of attribute solr_document.
Instance Method Summary collapse
-
#initialize(solr_document, current_ability, request = nil) ⇒ FileSetPresenter
constructor
A new instance of FileSetPresenter.
- #link_name ⇒ Object
- #page_title ⇒ Object
- #single_use_links ⇒ Object
Methods included from CharacterizationBehavior
#additional_characterization_metadata, #characterization_metadata, #characterized?, #label_for_term, #primary_characterization_values, #secondary_characterization_values
Methods included from PresentsAttributes
#attribute_to_html, #display_microdata?, #microdata_type_to_html, #permission_badge, #permission_badge_class
Methods included from ModelProxy
#persisted?, #to_model, #to_partial_path
Constructor Details
#initialize(solr_document, current_ability, request = nil) ⇒ FileSetPresenter
Returns a new instance of FileSetPresenter.
11 12 13 14 15 |
# File 'app/presenters/curation_concerns/file_set_presenter.rb', line 11 def initialize(solr_document, current_ability, request = nil) @solr_document = solr_document @current_ability = current_ability @request = request end |
Instance Attribute Details
#current_ability ⇒ Object
Returns the value of attribute current_ability.
6 7 8 |
# File 'app/presenters/curation_concerns/file_set_presenter.rb', line 6 def current_ability @current_ability end |
#request ⇒ Object
Returns the value of attribute request.
6 7 8 |
# File 'app/presenters/curation_concerns/file_set_presenter.rb', line 6 def request @request end |
#solr_document ⇒ Object
Returns the value of attribute solr_document.
6 7 8 |
# File 'app/presenters/curation_concerns/file_set_presenter.rb', line 6 def solr_document @solr_document end |
Instance Method Details
#link_name ⇒ Object
34 35 36 |
# File 'app/presenters/curation_concerns/file_set_presenter.rb', line 34 def link_name current_ability.can?(:read, id) ? label : 'File' end |
#page_title ⇒ Object
30 31 32 |
# File 'app/presenters/curation_concerns/file_set_presenter.rb', line 30 def page_title label end |
#single_use_links ⇒ Object
38 39 40 |
# File 'app/presenters/curation_concerns/file_set_presenter.rb', line 38 def single_use_links @single_use_links ||= SingleUseLink.where(itemId: id).map { |link| link_presenter_class.new(link) } end |