Class: Locomotive::MembershipPresenter
- Inherits:
-
BasePresenter
- Object
- BasePresenter
- Locomotive::MembershipPresenter
- Defined in:
- app/presenters/locomotive/membership_presenter.rb
Instance Attribute Summary
Attributes inherited from BasePresenter
Instance Method Summary collapse
- #can_update ⇒ Object
- #email ⇒ Object
- #grant_admin ⇒ Object
-
#name ⇒ Object
other getters / setters ##.
-
#role ⇒ Object
properties ##.
- #role_name ⇒ Object
Methods inherited from BasePresenter
#ability?, #after_initialize, getters_to_hash, #id, setters_to_hash, #site
Methods included from Presentable
#after_initialize, #as_json, #attributes=, #getters, #initialize, #property_options, #setters
Instance Method Details
#can_update ⇒ Object
25 26 27 28 |
# File 'app/presenters/locomotive/membership_presenter.rb', line 25 def can_update return nil unless self.ability? self.ability.can? :update, self.source end |
#email ⇒ Object
21 22 23 |
# File 'app/presenters/locomotive/membership_presenter.rb', line 21 def email self.source.account.email end |
#grant_admin ⇒ Object
30 31 32 33 |
# File 'app/presenters/locomotive/membership_presenter.rb', line 30 def grant_admin return nil unless self.ability? self.ability.can? :grant_admin, self.source end |
#name ⇒ Object
other getters / setters ##
13 14 15 |
# File 'app/presenters/locomotive/membership_presenter.rb', line 13 def name self.source.account.name end |
#role ⇒ Object
properties ##
6 |
# File 'app/presenters/locomotive/membership_presenter.rb', line 6 property :role |
#role_name ⇒ Object
17 18 19 |
# File 'app/presenters/locomotive/membership_presenter.rb', line 17 def role_name I18n.t("locomotive.memberships.roles.#{self.source.role}") end |