<% title _("Roles") %>
<% title_actions link_to_if_authorized(_("New role"), hash_for_new_role_path),
                 documentation_button('4.1.2RolesandPermissions') %>

<table class="table table-bordered table-striped table-two-pane">
  <thead>
    <tr>
      <th><%= sort :name, :as => s_("Role|Name") %></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <% for role in @roles %>
      <tr>
        <td class="display-two-pane">
          <%= content_tag(role.builtin? ? 'em' : 'span', role.builtin? ? role.name : link_to_if_authorized(trunc_with_tooltip(role.name), hash_for_edit_role_path(:id => role))) %>
        </td>
        <td>
          <% links = [display_link_if_authorized(_('Filters'),    hash_for_filters_path(:role_id => role)),
                      display_link_if_authorized(_('Add filter'), hash_for_new_filter_path(:role_id => role)),
                      display_link_if_authorized(_('Clone'), hash_for_clone_role_path(:id => role))] %>
          <% links.push(display_delete_if_authorized(hash_for_role_path(:id => role), :data => { :confirm => (_("Delete %s?") % role.name) } )) unless role.builtin? %>
          <%= action_buttons(*links) %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>
<%= will_paginate_with_info @roles %>
