- t_scope = 'dunlop.reports.users_permissions_table'
- permission_class = {read: 'book', manage: 'write', reset: 'undo'}
= page_title t('title', scope: t_scope)
table.ui.compact.celled.table
  thead
    tr
      th Role
      - @users.each do |user|
        th= link_to user.email.to_s.sub(/\@.*/, ''), [dunlop, :edit, user], title: user.email
  tbody
    tr
      td Admin?
      - @users.each do |user|
        td= boolean_show user.admin?
    - @table.each do |role, users|
      tr
        td= role
        - @users.each do |user|
          - if permissions = users[user]
            td
              - permissions.each do |p|
                i class="role-icon #{p} icon #{permission_class[p]}"
          - else
            td= boolean_show false

table
  caption= t 'legend_title', scope: t_scope
  tr
    th
      i.role-icon.checkmark.icon
    td=t 'permission.general', scope: t_scope
  tr
    th
      i.role-icon.read.book.icon
    td=t 'permission.read', scope: t_scope
  tr
    th
      i.role-icon.download.icon
    td=t 'permission.download', scope: t_scope
  tr
    th
      i.role-icon.manage.write.icon
    td=t 'permission.manage', scope: t_scope
  tr
    th
      i.role-icon.reset.undo.icon
    td=t 'permission.reset', scope: t_scope

