Class: Pageflow::Admin::UserAccountsTab Private
- Inherits:
-
ViewComponent
- Object
- Arbre::Component
- ViewComponent
- Pageflow::Admin::UserAccountsTab
- Defined in:
- app/views/components/pageflow/admin/user_accounts_tab.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #build(user) ⇒ Object private
Instance Method Details
#build(user) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/views/components/pageflow/admin/user_accounts_tab.rb', line 5 def build(user) (user.memberships.on_accounts .includes(:account).references(:pageflow_accounts) .accessible_by(current_ability, :index), blank_slate_text: t('pageflow.admin.users.no_accounts')) do table_for_collection class: 'memberships', sortable: true, i18n: Pageflow::Membership do column :account, sortable: 'pageflow_accounts.name' do |membership| if (:read, membership.account) link_to(membership.account.name, admin_account_path(membership.account)) else membership.account.name end end column :role, sortable: 'pageflow_memberships.role' do |membership| membership_role_with_tooltip(membership.role, scope: 'accounts') end column :created_at, sortable: 'pageflow_memberships.created_at' column do |membership| if (:update, membership) link_to(t('pageflow.admin.users.edit_role'), edit_admin_user_membership_path( user, membership, entity_type: 'Pageflow::Account' ), data: { rel: "edit_account_role_#{membership.role}" }) end end column do |membership| if (:destroy, membership) link_to(t('pageflow.admin.users.delete'), admin_user_membership_path(user, membership), method: :delete, data: { confirm: t('pageflow.admin.users.delete_account_membership_confirmation'), rel: "delete_account_membership_#{membership.role}" }) end end end if (:add_account_to, :users) (current_user, user, 'account') end end end |