Class: Hyrax::FileSetPresenter
- Inherits:
-
Object
- Object
- Hyrax::FileSetPresenter
- Defined in:
- app/presenters/hyrax/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
- #alpha_channels ⇒ Object
- #editor? ⇒ Boolean
-
#event_class ⇒ Object
This overrides the method in WithEvents.
- #events(size = 100) ⇒ Object
-
#first_title ⇒ Object
The first title assertion.
- #fixity_check_status ⇒ Object
-
#initialize(solr_document, current_ability, request = nil) ⇒ FileSetPresenter
constructor
A new instance of FileSetPresenter.
- #license ⇒ Object
-
#link_name ⇒ Object
The link text when linking to the show page of this FileSet.
-
#page_title ⇒ Object
The title of the webpage that shows this FileSet.
- #parent ⇒ Object
- #single_use_links ⇒ Object
- #stats_path ⇒ Object
- #tweeter ⇒ Object
- #user_can_perform_any_action? ⇒ Boolean
Methods included from DisplaysImage
Methods included from WithEvents
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.
14 15 16 17 18 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 14 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.
9 10 11 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 9 def current_ability @current_ability end |
#request ⇒ Object
Returns the value of attribute request.
9 10 11 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 9 def request @request end |
#solr_document ⇒ Object
Returns the value of attribute solr_document.
9 10 11 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 9 def solr_document @solr_document end |
Instance Method Details
#alpha_channels ⇒ Object
36 37 38 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 36 def alpha_channels [] end |
#editor? ⇒ Boolean
59 60 61 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 59 def editor? current_ability.can?(:edit, solr_document) end |
#event_class ⇒ Object
This overrides the method in WithEvents
81 82 83 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 81 def event_class solr_document.to_model.model_name.name end |
#events(size = 100) ⇒ Object
76 77 78 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 76 def events(size = 100) super(size) end |
#first_title ⇒ Object
The first title assertion
50 51 52 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 50 def first_title title.first end |
#fixity_check_status ⇒ Object
85 86 87 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 85 def fixity_check_status Hyrax::FixityStatusPresenter.new(id).render_file_set_status end |
#license ⇒ Object
67 68 69 70 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 67 def license return if solr_document.license.nil? solr_document.license.first end |
#link_name ⇒ Object
The link text when linking to the show page of this FileSet
55 56 57 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 55 def link_name current_ability.can?(:read, id) ? first_title : 'File' end |
#page_title ⇒ Object
The title of the webpage that shows this FileSet.
45 46 47 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 45 def page_title "#{human_readable_type} | #{title.first} | ID: #{id} | #{I18n.t('hyrax.product_name')}" end |
#parent ⇒ Object
89 90 91 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 89 def parent @parent_presenter ||= fetch_parent_presenter end |
#single_use_links ⇒ Object
40 41 42 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 40 def single_use_links @single_use_links ||= SingleUseLink.where(itemId: id).map { |link| link_presenter_class.new(link) } end |
#stats_path ⇒ Object
72 73 74 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 72 def stats_path Hyrax::Engine.routes.url_helpers.stats_file_path(self, locale: I18n.locale) end |
#tweeter ⇒ Object
63 64 65 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 63 def tweeter TwitterPresenter.twitter_handle_for(user_key: depositor) end |
#user_can_perform_any_action? ⇒ Boolean
93 94 95 |
# File 'app/presenters/hyrax/file_set_presenter.rb', line 93 def user_can_perform_any_action? current_ability.can?(:edit, id) || current_ability.can?(:destroy, id) || current_ability.can?(:download, id) end |