<% count, preview = @product_group.generate_preview(Spree::Config[:admin_pgroup_preview_size]) %>

<h2><%= Spree::ProductGroup.human_attribute_name(:products) %> (<%= count %>)</h2>

<% if count == 0 %>
  <p data-hook="preview_empty"><%= t(:no_match_found) %></p>
<% else %>

  <% if count > Spree::Config[:admin_pgroup_preview_size] %>
    <p data-hook="preview_showing"><%= t(:showing_first_n, :n => Spree::Config[:admin_pgroup_preview_size]) %></p>
  <% end %>

  <table class="index" data-hook="preview">
    <thead>
      <tr data-hook="preview_header">
        <th><%= Spree::Product.human_attribute_name(:name) %></th>
        <th><%= t(:action) %></th>
      </tr>
    </thead>
    <tbody>
    <% preview.each do |product| %>
      <tr data-hook="preview_row">
        <td>
          <%= link_to product.name, product_url(product) %>
        </td>
        <td>
          <%= link_to t(:edit), edit_admin_product_path(product) %>
        </td>
      </tr>
    <% end %>
    </tbody>
  </table>
<% end %>
