Class: Hyrax::HomepagePresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/hyrax/homepage_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(current_ability, collections) ⇒ HomepagePresenter

Returns a new instance of HomepagePresenter.



5
6
7
8
# File 'app/presenters/hyrax/homepage_presenter.rb', line 5

def initialize(current_ability, collections)
  @current_ability = current_ability
  @collections = collections
end

Instance Attribute Details

#collectionsObject (readonly)

Returns the value of attribute collections.



3
4
5
# File 'app/presenters/hyrax/homepage_presenter.rb', line 3

def collections
  @collections
end

#current_abilityObject (readonly)

Returns the value of attribute current_ability.



3
4
5
# File 'app/presenters/hyrax/homepage_presenter.rb', line 3

def current_ability
  @current_ability
end

Instance Method Details

#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.

Returns:

  • (Boolean)

    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.



13
14
15
16
# File 'app/presenters/hyrax/homepage_presenter.rb', line 13

def display_share_button?
  (user_unregistered? && Hyrax.config.display_share_button_when_not_logged_in?) ||
    current_ability.can_create_any_work?
end