Sha256: a9a50ee776c82baf63c6e830410284c2ae5c2c1fe08af259c9259e5b3cd262be

Contents?: true

Size: 760 Bytes

Versions: 17

Compression:

Stored size: 760 Bytes

Contents

module Locomotive
  class MembershipPresenter < BasePresenter

    ## properties ##

    property    :role
    properties  :role_name, :can_update, :grant_admin, only_getter: true
    property    :account_id
    property    :name, only_getter: true
    property    :email

    ## other getters / setters ##

    def name
      self.__source.account.name
    end

    def role_name
      I18n.t("locomotive.memberships.roles.#{self.__source.role}")
    end

    def email
      self.__source.account.email
    end

    def can_update
      return nil unless self.ability?
      self.__ability.can? :update, self.__source
    end

    def grant_admin
      return nil unless self.ability?
      self.__ability.can? :grant_admin, self.__source
    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
locomotive_cms-2.5.7 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.5.6 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.5.6.rc2 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.5.6.rc1 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.5.5 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.5.4 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.5.3 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.5.2 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.5.1 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.5.0 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.5.0.rc3 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.5.0.rc2 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.5.0.rc1 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.4.1 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.4.0 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.3.1 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.3.0 app/presenters/locomotive/membership_presenter.rb