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

<%= environments_title_actions %>

<table class="table table-bordered table-striped table-two-pane">
  <tr>
    <th><%= sort :name, :as => s_('Environment|Name') %></th>
    <th><%= sort :hosts_count, :as => _('Hosts'), :default => "DESC" %></th>
    <th></th>
  </tr>

  <% @environments.each do |environment| %>
    <tr>
      <td>
        <%= link_to_if_authorized trunc(environment.name), hash_for_edit_environment_path(:id => environment.name).merge(:auth_object => environment, :authorizer => authorizer) %>
      </td>
      <td><%= link_to environment.hosts_count, hosts_path(:search => "environment = #{environment}") %>
      <td>
        <%= action_buttons(link_to(_('Classes'), puppetclasses_path(:search => "environment = #{environment}")),
                           import_proxy_links(hash_for_import_environments_environments_path(:env => environment.name)),
                           display_delete_if_authorized(hash_for_environment_path(:id => environment.name).merge(:auth_object => environment, :authorizer => authorizer), :confirm => "Delete #{environment.name}?")) %>
      </td>
    </tr>
  <% end %>
</table>

<%= page_entries_info @environments %>
<%= will_paginate @environments %>
