<%= paginate @products, remote: true %>
<% row = 0 %>
  <% @products.each do |product| %>
    <% if row == 0 %>
      <div class="row column-4">
      <% end %>
      <div class="col-sm-6 col-md-3">
        <div class="thumbnail store style2">
          <div class="header">
            <figure style="min-height:338px; background-color: white;">
              <% if !product.images.blank? %>
                <%= link_to(image_tag(product.cover_image.image.url(:large), style: 'margin: auto;vertical-align: middle;display: inline-block;'), {controller: :product, action: :show, id: product.slug}, 'data-toggle': 'modal', 'data-target': ".productQuickView",
                style: 'line-height: 338px;') %>
              <% else %>
                <%= link_to(image_tag('kaktus.png'), {controller: :product, action: :show, id: product.slug}, 'data-toggle': 'modal', 'data-target': ".productQuickView") %>
              <% end %>
            </figure>
            <div class="icons">
              <%= raw link_to(raw('<i class="fa fa-search"></i>'), {controller: :product, action: :show, id: product.slug}, class: 'icon', 'data-toggle': 'modal', 'data-target': ".productQuickView") %>
              <a class="icon" href="" onclick="addToCart(event,'<%= product.slug %>');">
                <i class="fa fa-cart-plus mr-5"></i>Dodaj do koszyka</a>
            </div>
          </div>
          <div class="caption">
            <h6 class="regular"><%= link_to(product.name, {controller: :product, action: :show, id: product.slug}, 'data-toggle': 'modal', 'data-target': ".productQuickView") %></h6>
            <div class="price">
              <span class="amount text-primary">PLN
                <%= '%.2f' % product.price %></span>
              <div class="category text-uppercase alt-font"><%= raw product.description_short %></div>
            </div>
          </div>
          <!-- end caption -->
        </div>
        <!-- end thumbnail -->
      </div>
      <% row += 1 %>
        <% if row == 4
            row = 0
        %>
        </div>
      <% end %>
    <% end %>
    <% if row > 0 && row < 4 %>
    </div>
  <% end %>
