Sha256: e8c06c41fa18edde65148ac1334ef669639d555fcfe63b9c51552165ee374595

Contents?: true

Size: 637 Bytes

Versions: 6

Compression:

Stored size: 637 Bytes

Contents

module Locomotive
  class MembershipPresenter < BasePresenter

    delegate :role, :to => :source

    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

    def included_methods
      super + %w(name email role role_name can_update grant_admin)
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
locomotive_cms-2.0.0.rc7 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.0.0.rc6 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.0.0.rc5 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.0.0.rc4 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.0.0.rc2 app/presenters/locomotive/membership_presenter.rb
locomotive_cms-2.0.0.rc1 app/presenters/locomotive/membership_presenter.rb