d-breadcrumbs as |breadcrumb|
  breadcrumb.item
    = link-to 'user.index': span= t 'models.plural.user'
  breadcrumb.item active=true
    span= t 'models.user'
    span : 
    = model.nickname
.ui.container
  .ui.header
    .ui.right.floated.icon.buttons
      = push-action type='edit' action='editUser' model=model
    h2
      span.resource-descriptor= t 'models.user'
      span.resource-name= model.nickname
  table.ui.definition.table
    tr
      td= t 'attributes.user.nickname'
      td= model.nickname
    tr
      td= t 'attributes.user.email'
      td= model.email
  br
  = partial 'user/show-user-addition-overload'

/ disable authorizations
/if (can 'manage' 'model' 'user')
  .ui.two.column.grid
    .column
      .ui.top.attached.header.block
        .content PANDA
        .ui.right.floated.buttons
          .ui.icon.button class="{{if (contains 'ban-app-panda' active_authorizations) 'active'}}" click="'set_permission' (hash type='app' target='panda') 'ban'"
            i.ban.icon
          .or
          .ui.button class="{{if (contains 'read-app-panda' active_authorizations) 'active'}}" click="'set_permission' (hash type='app' target='panda') 'read'"
            | read
          .or
          .ui.button class="{{if (contains 'manage-app-panda' active_authorizations) 'active'}}" click="'set_permission' (hash type='app' target='panda') 'manage'"
            | manage
      unless (contains 'ban-app-panda' active_authorizations)
        table.ui.bottom.attached.compact.definition.table
          each panda_authorizations as |authorization|
            tr
              td
                = authorization.type
                '
                = authorization.target
              td
                .ui.buttons
                  .ui.icon.button class="{{if (contains (concat 'ban-' authorization.type '-' authorization.target) active_authorizations) 'active'}}" click="'set_permission' authorization 'ban'"
                    i.ban.icon
                  each authorization.permissions as |permission|
                    .or
                    .ui.button class="{{if (contains (concat permission '-' authorization.type '-' authorization.target) active_authorizations) 'active'}}" click="'set_permission' authorization permission"
                      = permission
    each adapters as |adapter|
      .column
        .ui.top.attached.header.block
          = adapter.title
          .ui.right.floated.buttons
            .ui.icon.button class="{{if (contains (concat 'ban-adapter-' adapter.id) active_authorizations) 'active'}}" click="'set_permission' (hash type='adapter' target=adapter.id) 'ban'"
              i.ban.icon
            .or
            .ui.button class="{{if (contains (concat 'read-adapter-' adapter.id) active_authorizations) 'active'}}" click="'set_permission' (hash type='adapter' target=adapter.id) 'read'"
              | read
            .or
            .ui.button class="{{if (contains (concat 'manage-adapter-' adapter.id) active_authorizations) 'active'}}" click="'set_permission' (hash type='adapter' target=adapter.id) 'manage'"
              | manage
        unless (contains (concat 'ban-adapter-' adapter.id) active_authorizations)
          table.ui.bottom.attached.compact.definition.table
            each adapter.authorizations as |authorization|
              tr
                td
                  = authorization.type
                  '
                  = authorization.target
                td
                  .ui.buttons
                    .ui.icon.button class="{{if (contains (concat 'ban-' authorization.type '-' authorization.target) active_authorizations) 'active'}}" click="'set_permission' authorization 'ban'"
                      i.ban.icon
                    each authorization.permissions as |permission|
                      .or
                      .ui.button class="{{if (contains (concat permission '-' authorization.type '-' authorization.target) active_authorizations) 'active'}}" click="'set_permission' authorization permission"
                        = permission
                        /= concat permission '-' authorization.type '-' authorization.target
  .ui.segment
    button.ui.button{action 'save_permissions'} Save permissions
