<%= include_javascript %>

<% title _("Provisioning Templates") %>

<% title_actions display_link_if_authorized(_("New Template"), hash_for_new_provisioning_template_path),
                 display_link_if_authorized(_("Build PXE Default"), { :controller => 'provisioning_templates', :action => :build_pxe_default },{
                   :confirm => _("You are about to change the default PXE menu on all configured TFTP servers - continue?"),
                   :class => "btn btn-info"}),
                documentation_button('4.4.3ProvisioningTemplates')
%>

<table class="table table-bordered table-striped table-two-pane">
  <thead>
    <tr>
      <th><%= sort :name, :as => s_("ProvisioningTemplate|Name") %></th>
      <th><%= _("Host group / Environment") %></th>
      <th><%= sort :kind, :as => _("Kind") %></th>
      <th><%= sort :snippet, :as => s_("ProvisioningTemplate|Snippet") %></th>
      <th><%= sort :locked, :as => s_("ProvisioningTemplate|Locked"), :default => "DESC" %></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <% for provisioning_template in @templates %>
    <tr>
        <td class="display-two-pane"><%= link_to_if_authorized trunc_with_tooltip(provisioning_template),
                                         hash_for_edit_provisioning_template_path(:id => provisioning_template.to_param).
                                         merge(:auth_object => provisioning_template, :authorizer => authorizer,
                                         :permission => 'edit_provisioning_templates') %>
        </td>
        <td><%= combination provisioning_template %></td>
        <td><%= provisioning_template.try(:template_kind) %></td>
        <td align='center'><%= checked_icon provisioning_template.snippet %></td>
        <td align='center'><%= locked_icon provisioning_template.locked?, _("This template is locked for editing.") %>
        </td>
        <td><%= action_buttons(*permitted_actions(provisioning_template)) %></td>
      </tr>
    <% end %>
  </tbody>
</table>
<%= will_paginate_with_info @templates %>
