Module: Pageflow::Admin::MembershipsHelper
- Defined in:
- app/helpers/pageflow/admin/memberships_helper.rb
Overview
Instance Method Summary collapse
- #membership_entity_select(f, parent, entity_type) ⇒ Object
- #membership_roles_collection(entity_type) ⇒ Object
- #membership_user_select(f, parent) ⇒ Object
Instance Method Details
#membership_entity_select(f, parent, entity_type) ⇒ Object
15 16 17 18 19 20 21 |
# File 'app/helpers/pageflow/admin/memberships_helper.rb', line 15 def membership_entity_select(f, parent, entity_type) if entity_type == 'Pageflow::Entry' membership_entry_select(f, parent) else membership_account_select(f, parent) end end |
#membership_roles_collection(entity_type) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/pageflow/admin/memberships_helper.rb', line 23 def membership_roles_collection(entity_type) = [[I18n.t('pageflow.admin.users.roles.previewer'), :previewer], [I18n.t('pageflow.admin.users.roles.editor'), :editor], [I18n.t('pageflow.admin.users.roles.publisher'), :publisher], [I18n.t('pageflow.admin.users.roles.manager'), :manager]] if entity_type == 'Pageflow::Account' [[I18n.t('pageflow.admin.users.roles.member'), :member]] + else end end |
#membership_user_select(f, parent) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'app/helpers/pageflow/admin/memberships_helper.rb', line 4 def membership_user_select(f, parent) if f.object.persisted? membership_disabled_select(f, :user, f.object.user, :formal_name) elsif parent.is_a?(User) membership_disabled_select(f, :user, parent, :formal_name) else parent_type = parent.class.model_name.singular_route_key membership_select(f, :user, parent, :"potential_users_for_#{parent_type}") end end |