Class: Hyrax::HomepagePresenter
- Inherits:
-
Object
- Object
- Hyrax::HomepagePresenter
- Defined in:
- app/presenters/hyrax/homepage_presenter.rb
Instance Attribute Summary collapse
-
#collections ⇒ Object
readonly
Returns the value of attribute collections.
-
#current_ability ⇒ Object
readonly
Returns the value of attribute current_ability.
Instance Method Summary collapse
- #create_many_work_types? ⇒ Boolean
-
#create_work_presenter ⇒ Object
A presenter for selecting a work type to create this is needed here because the selector is in the header on every page.
-
#display_share_button? ⇒ Boolean
If the current user is a guest and the display_share_button_when_not_logged_in? is activated, then return true.
- #draw_select_work_modal? ⇒ Boolean
- #first_work_type ⇒ Object
-
#initialize(current_ability, collections) ⇒ HomepagePresenter
constructor
A new instance of HomepagePresenter.
Constructor Details
#initialize(current_ability, collections) ⇒ HomepagePresenter
Returns a new instance of HomepagePresenter.
8 9 10 11 |
# File 'app/presenters/hyrax/homepage_presenter.rb', line 8 def initialize(current_ability, collections) @current_ability = current_ability @collections = collections end |
Instance Attribute Details
#collections ⇒ Object (readonly)
Returns the value of attribute collections.
6 7 8 |
# File 'app/presenters/hyrax/homepage_presenter.rb', line 6 def collections @collections end |
#current_ability ⇒ Object (readonly)
Returns the value of attribute current_ability.
6 7 8 |
# File 'app/presenters/hyrax/homepage_presenter.rb', line 6 def current_ability @current_ability end |
Instance Method Details
#create_many_work_types? ⇒ Boolean
27 28 29 |
# File 'app/presenters/hyrax/homepage_presenter.rb', line 27 def create_many_work_types? create_work_presenter.many? end |
#create_work_presenter ⇒ Object
A presenter for selecting a work type to create this is needed here because the selector is in the header on every page
23 24 25 |
# File 'app/presenters/hyrax/homepage_presenter.rb', line 23 def create_work_presenter @create_work_presenter ||= create_work_presenter_class.new(current_ability.current_user) end |
#display_share_button? ⇒ Boolean
Returns If the current user is a guest and the display_share_button_when_not_logged_in? is activated, then return true. Otherwise return true if the signed in user has permission to create at least one kind of work.
16 17 18 19 |
# File 'app/presenters/hyrax/homepage_presenter.rb', line 16 def (user_unregistered? && Hyrax.config.) || current_ability.can_create_any_work? end |
#draw_select_work_modal? ⇒ Boolean
31 32 33 |
# File 'app/presenters/hyrax/homepage_presenter.rb', line 31 def draw_select_work_modal? && create_many_work_types? end |
#first_work_type ⇒ Object
35 36 37 |
# File 'app/presenters/hyrax/homepage_presenter.rb', line 35 def first_work_type create_work_presenter.first_model end |