<% title _('Puppet Environments') %>

<%= environments_title_actions %>

<table class="table table-bordered table-striped table-two-pane">
  <thead>
    <tr>
      <th><%= sort :name, :as => s_('Environment|Name') %></th>
      <th><%= sort :hosts_count, :as => _('Hosts'), :default => "DESC" %></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <% @environments.each do |environment| %>
      <tr>
        <td class="display-two-pane">
          <%= link_to_if_authorized trunc_with_tooltip(environment.name), hash_for_edit_environment_path(:id => environment).merge(:auth_object => environment, :authorizer => authorizer) %>
        </td>
        <td><%= link_to environment.hosts_count, hosts_path(:search => "environment = #{environment}") %></td>
        <td>
          <%= action_buttons(link_to(_('Classes'), puppetclasses_path(:search => "environment = #{environment}")),
                             import_proxy_links(hash_for_import_environments_environments_path(:env => environment)),
                             display_delete_if_authorized(hash_for_environment_path(:id => environment).merge(:auth_object => environment, :authorizer => authorizer), :data => { :confirm => "Delete #{environment.name}?" })) %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>
<%= will_paginate_with_info @environments %>
