<div class="modal-head">
  <h2><%= "Edit Permission #{message("projects_role.#{@permission}")} For: " + @permission_template.name -%></h2>
</div>

<div class="modal-body">
  <div id="select-list-user"></div>
</div>

<div class="modal-foot">
  <a href="#" onclick="window.location.reload();return false"><%= h message('close') -%></a>
</div>

<script>
  var selectList = new SelectList({
    el: '#select-list-user',
    width: '100%',
    format: function (item) { return item.name + ' <div class="subtitle">' + item.login + '</div>'; },
    searchUrl: baseUrl + '/permission_templates/search_users?permission=<%= @permission -%>&template=<%= @permission_template.key -%>',
    selectUrl: baseUrl + '/permission_templates/add_user_permission',
    deselectUrl: baseUrl + '/permission_templates/remove_user_permission',
    extra: {
      permission: '<%= @permission -%>',
      template: '<%= @permission_template.key -%>'
    },
    selectParameter: 'user',
    selectParameterValue: 'login',
    labels: {
      selected: 'With',
      deselected: 'Without',
      all: 'All'
    },
    tooltips: {
      select: 'Click to grant the permission to the user',
      deselect: 'Click to revoke the permission from the user'
    }
  });
</script>
