<% 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><%= _('Hosts') %></th>
    <th></th>
  </tr>

  <% @environments.each do |environment| %>
    <tr>
      <td>
        <%= link_to_if_authorized environment.name, hash_for_edit_environment_path(:id => environment.name) %>
      </td>
      <td><%= link_to @host_counter[environment.id] || 0, hosts_path(:search => "environment = #{environment}") %>
      <td>
        <%= action_buttons(link_to(_('Classes'), puppetclasses_path(:search => "environment = #{environment}")),
                           display_delete_if_authorized(hash_for_environment_path(:id => environment.name), :confirm => "Delete #{environment.name}?")) %>
      </td>
    </tr>
  <% end %>
</table>

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