Class: Locomotive::MembershipPresenter

Inherits:
BasePresenter show all
Defined in:
app/presenters/locomotive/membership_presenter.rb

Instance Attribute Summary

Attributes inherited from BasePresenter

#__ability, #__depth

Instance Method Summary collapse

Methods inherited from BasePresenter

#_id, #ability?, #after_initialize, #errors, #formatted_time, getters_or_setters_to_hash, getters_to_hash, #html_view?, #include_errors?, setters_to_hash, #site, #true

Methods included from Presentable

#after_initialize, #as_json, #attributes=, #getters, #initialize, #property_options, #setters

Instance Method Details

#can_updateObject



26
27
28
29
# File 'app/presenters/locomotive/membership_presenter.rb', line 26

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

#emailObject



22
23
24
# File 'app/presenters/locomotive/membership_presenter.rb', line 22

def email
  self.__source..email
end

#grant_adminObject



31
32
33
34
# File 'app/presenters/locomotive/membership_presenter.rb', line 31

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

#nameObject

other getters / setters ##



14
15
16
# File 'app/presenters/locomotive/membership_presenter.rb', line 14

def name
  self.__source..name
end

#roleObject

properties ##



6
# File 'app/presenters/locomotive/membership_presenter.rb', line 6

property    :role

#role_nameObject



18
19
20
# File 'app/presenters/locomotive/membership_presenter.rb', line 18

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