app/views/variants/_index.html.erb

Summary

Maintainability
Test Coverage

<div class="box">
  <div class="box-header">
    <h3 class="box-title">Variants</h3>
    <div class="box-tools pull-right">
      <div class="btn-group">
        <%= link_to "Add Variant", new_product_variant_path(product.id), class: "btn btn-primary" %>
      </div>
    </div>
  </div>
  <div class="box-body">
    <div class="">
      <table class="table" id="users-table" data-source="<%= users_path(format: :json)%>" >
        <thead>
          <tr>
            <th> Properties </th>
            <th> SKU </th>
            <th> Price </th>
            <th> Status </th>
            <th> Actions </th>
          </tr>
        </thead>
        <tbody>
          <% variants.active_status.not_default.each do |variant| %>
            <tr>
              <td><%= variant.option_value_names %></td>
              <td><%= variant.sku %></td>
              <td><%= number_to_currency variant.price, unit: 'P ' %> </td>
              <td><%= variant.status.humanize %> </td>
              <td><%= render "variants/actions", variant: variant, product: product %> </td>
            </tr>
          <% end %>

          <% if variants.not_default.count == 0 %>
            <tr>
              <td colspan=5 class='text-center'> Nothing to show</td>
            </tr>
          <% end %>
        </tbody>
      </table>
    </div>
  </div>
</div>