<% html_title l(:label_ux_toolkit_checklist_templates) %>

<div class="contextual">
  <%= link_to l(:label_ux_toolkit_tracker_checklist_defaults),
              ux_toolkit_tracker_checklist_templates_path,
              class: 'icon icon-settings' %>
  <%= link_to l(:label_ux_toolkit_new_checklist_template),
              new_ux_toolkit_checklist_template_path,
              class: 'icon icon-add' %>
</div>

<h2><%= l(:label_ux_toolkit_checklist_templates) %></h2>

<% if @templates.any? %>
  <table class="list ux-toolkit-template-list">
    <thead>
      <tr>
        <th><%= l(:label_ux_toolkit_template_name) %></th>
        <th><%= l(:label_ux_toolkit_template_active) %></th>
        <th><%= l(:label_ux_toolkit_items_count) %></th>
        <th><%= l(:field_updated_on) %></th>
        <th></th>
      </tr>
    </thead>
    <tbody>
      <% @templates.each do |template| %>
        <tr class="<%= cycle('odd', 'even') %>">
          <td class="name"><%= link_to h(template.name), edit_ux_toolkit_checklist_template_path(template) %></td>
          <td><%= checked_image template.active? %></td>
          <td><%= template.items.size %></td>
          <td><%= format_time(template.updated_at) %></td>
          <td class="buttons">
            <%= link_to l(:button_edit),
                        edit_ux_toolkit_checklist_template_path(template),
                        class: 'icon icon-edit' %>
            <%= link_to l(:button_delete),
                        ux_toolkit_checklist_template_path(template),
                        method: :delete,
                        data: {confirm: l(:text_ux_toolkit_confirm_delete_checklist_template)},
                        class: 'icon icon-del' %>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>
<% else %>
  <p class="nodata"><%= l(:text_ux_toolkit_no_checklist_templates) %></p>
<% end %>
