Sha256: cdb53705025706ae369dba2b705c3b58d5d05fc126a5ed188c5c5dc6592539b2

Contents?: true

Size: 798 Bytes

Versions: 12

Compression:

Stored size: 798 Bytes

Contents

module Hyrax
  class HomepagePresenter
    attr_reader :current_ability, :collections

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

    # @return [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.
    def display_share_button?
      (user_unregistered? && Hyrax.config.display_share_button_when_not_logged_in?) ||
        current_ability.can_create_any_work?
    end

    private

      def user_unregistered?
        current_ability.current_user.new_record? ||
          current_ability.current_user.guest?
      end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hyrax-2.0.3 app/presenters/hyrax/homepage_presenter.rb
hyrax-2.0.2 app/presenters/hyrax/homepage_presenter.rb
hyrax-2.0.1 app/presenters/hyrax/homepage_presenter.rb
hyrax-2.0.0 app/presenters/hyrax/homepage_presenter.rb
hyrax-2.0.0.rc3 app/presenters/hyrax/homepage_presenter.rb
hyrax-2.0.0.rc2 app/presenters/hyrax/homepage_presenter.rb
hyrax-2.0.0.rc1 app/presenters/hyrax/homepage_presenter.rb
hyrax-2.0.0.beta5 app/presenters/hyrax/homepage_presenter.rb
hyrax-2.0.0.beta4 app/presenters/hyrax/homepage_presenter.rb
hyrax-2.0.0.beta3 app/presenters/hyrax/homepage_presenter.rb
hyrax-2.0.0.beta2 app/presenters/hyrax/homepage_presenter.rb
hyrax-2.0.0.beta1 app/presenters/hyrax/homepage_presenter.rb