<section class='field'>
  <ul class='permission-list'>
    {{#each model.permissions as |p|}}
      <li>
        <span class="name"><span class="badge-group">{{p.group_name}}</span></span>
        {{{i18n "category.can"}}}
        <span class="permission">{{p.permission.description}}</span>
        {{#if controller.editingPermissions}}
          <a {{action "removePermission" p}}><i class="fa fa-times-circle"></i></a>
        {{/if}}
      </li>
    {{/each}}
  </ul>
  {{#if controller.editingPermissions}}
    {{view 'select' content=availableGroups value=selectedGroup}}
    {{view 'select' class="permission-selector" optionValuePath="content.id" optionLabelPath="content.description" content=availablePermissions value=selectedPermission}}
    <button {{action "addPermission" selectedGroup selectedPermission}} class="btn btn-small">{{i18n 'category.add_permission'}}</button>
  {{else}}
    <button {{action "editPermissions"}} class="btn btn-small">{{i18n 'category.edit_permissions'}}</button>
  {{/if}}
</section>
