mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-22 06:06:45 +00:00
Add role_priveleges
helper method
This commit is contained in:
parent
44d92fa4f6
commit
ab4c4a02c8
|
@ -11,6 +11,13 @@ module Admin
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def role_priveleges(role)
|
||||||
|
role
|
||||||
|
.permissions_as_keys
|
||||||
|
.map { |privilege| t("admin.roles.privileges.#{privilege}") }
|
||||||
|
.join(', ')
|
||||||
|
end
|
||||||
|
|
||||||
def disable_permissions?(permissions)
|
def disable_permissions?(permissions)
|
||||||
permissions.filter { |privilege| role_flag_value(privilege).zero? }
|
permissions.filter { |privilege| role_flag_value(privilege).zero? }
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,6 +25,6 @@
|
||||||
- else
|
- else
|
||||||
= link_to t('admin.roles.assigned_users', count: role.users.count), admin_accounts_path(role_ids: role.id)
|
= link_to t('admin.roles.assigned_users', count: role.users.count), admin_accounts_path(role_ids: role.id)
|
||||||
·
|
·
|
||||||
%abbr{ title: role.permissions_as_keys.map { |privilege| I18n.t("admin.roles.privileges.#{privilege}") }.join(', ') }= t('admin.roles.permissions_count', count: role.permissions_as_keys.size)
|
%abbr{ title: role_priveleges(role) }= t('admin.roles.permissions_count', count: role.permissions_as_keys.size)
|
||||||
%div
|
%div
|
||||||
= table_link_to 'edit', t('admin.accounts.edit'), edit_admin_role_path(role) if can?(:update, role)
|
= table_link_to 'edit', t('admin.accounts.edit'), edit_admin_role_path(role) if can?(:update, role)
|
||||||
|
|
Loading…
Reference in a new issue