Sha256: adcec66160ef013911165f31d1e0788a981396f3e25eca1b540e7e07f28e43b0

Contents?: true

Size: 691 Bytes

Versions: 58

Compression:

Stored size: 691 Bytes

Contents

module Hyrax
  class UserProfilePresenter
    def initialize(user, ability)
      @user = user
      @ability = ability
    end

    attr_reader :user, :ability

    delegate :name, to: :user

    # @return true if the presenter is for the logged in user
    def current_user?
      user == ability.current_user
    end

    def events
      @events ||= if user.respond_to? :profile_events
                    user.profile_events(100)
                  else
                    []
                  end
    end

    # @return [Array<TrophyPresenter>] list of TrophyPresenters for this profile.
    def trophies
      @trophies ||= Hyrax::TrophyPresenter.find_by_user(user)
    end
  end
end

Version data entries

58 entries across 58 versions & 2 rubygems

Version Path
hyrax-2.9.6 app/presenters/hyrax/user_profile_presenter.rb
hyrax-2.9.5 app/presenters/hyrax/user_profile_presenter.rb
hyrax-2.9.4 app/presenters/hyrax/user_profile_presenter.rb
hyrax-2.9.3 app/presenters/hyrax/user_profile_presenter.rb
hyrax-2.9.2 app/presenters/hyrax/user_profile_presenter.rb
hyrax-2.9.1 app/presenters/hyrax/user_profile_presenter.rb
hyrax-2.9.0 app/presenters/hyrax/user_profile_presenter.rb
hyrax-2.8.0 app/presenters/hyrax/user_profile_presenter.rb
hyrax-2.7.2 app/presenters/hyrax/user_profile_presenter.rb
hyrax-2.7.1 app/presenters/hyrax/user_profile_presenter.rb
hyrax-2.7.0 app/presenters/hyrax/user_profile_presenter.rb
hyrax-2.6.0 app/presenters/hyrax/user_profile_presenter.rb
hyrax-3.0.0.pre.rc1 app/presenters/hyrax/user_profile_presenter.rb
hyrax-3.0.0.pre.beta3 app/presenters/hyrax/user_profile_presenter.rb
hyrax-2.5.1 app/presenters/hyrax/user_profile_presenter.rb
hyrax-2.5.0 app/presenters/hyrax/user_profile_presenter.rb
hyrax-3.0.0.pre.beta2 app/presenters/hyrax/user_profile_presenter.rb
hyrax-2.4.1 app/presenters/hyrax/user_profile_presenter.rb
hyrax-3.0.0.pre.beta1 app/presenters/hyrax/user_profile_presenter.rb
hyrax-2.4.0 app/presenters/hyrax/user_profile_presenter.rb