<%= javascript 'class_edit' %>

<% title _('Config groups') %>

<% title_actions display_link_if_authorized(_('New Config Group'), hash_for_new_config_group_path), help_path %>

<table class="table table-bordered table-striped table-two-pane">
  <thead>
    <tr>
      <th><%= sort :name %></th>
      <th><%= sort :config_group_classes_count, :as => _('Puppet classes'), :default => "DESC" %></th>
      <th><%= sort :hosts_count, :as => _('Hosts'), :default => "DESC" %></th>
      <th><%= sort :hostgroups_count, :as => _('Host groups'), :default => "DESC" %></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <% @config_groups.each do |config_group| %>
      <tr>
        <td class="display-two-pane"><%= link_to_if_authorized trunc_with_tooltip(config_group.name), hash_for_edit_config_group_path(config_group).merge(:auth_object => config_group, :authorizer => authorizer) %></td>
        <td><%= link_to config_group.config_group_classes_count, puppetclasses_path(:search => %Q{config_group = "#{config_group}"}) %></td>
        <td><%= link_to config_group.hosts_count, hosts_path(:search => %Q{config_group = "#{config_group}"}) %></td>
        <td><%= link_to config_group.hostgroups_count, hostgroups_path(:search => %Q{config_group = "#{config_group}"}) %></td>
        <td><%= action_buttons(
                  display_link_if_authorized(_('Edit'), hash_for_edit_config_group_path(config_group).merge(:auth_object => config_group, :authorizer => authorizer)),
                  display_delete_if_authorized(hash_for_config_group_path(config_group).merge(:auth_object => config_group, :authorizer => authorizer), :data => { :confirm => _('Delete %s?') % config_group.name }))%>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>
<%= will_paginate_with_info @config_groups %>
