<% @products = (@templates if type.eql?('templates')) || (@extensions if type.eql?('extensions')) %>
<% cache [ 'product list', expires_in: 60.seconds ] do %>
 <% @products.each do |product| %>
  <div class="card-content <%= type == 'templates' ? type : 'apps' %>">
    <div class="card-inner">
      <div class="cover">
        <%= link_to "", product, :class=> "details-link" %>
        <div class="cover-image">
          <% if product.thumbnail.present? %>
            <%= image_tag(type == "templates" ? product.thumbnail.thumb_template_index.url : (type == "extensions" ? product.thumbnail.thumb_index.url : ""))%>
          <% else%>
           <%= placeholdit_image_tag (type == 'templates' ? "256x180" : '100x100'), background_color: "#3f3f3f" %>
          <% end %>
        </div>
      </div>
      <div class="details">
        <%= content_tag(:h2, (link_to product.title, product), :class => "item-title") %>
        <%= content_tag(:p, (link_to "Developer: #{product.author}"), :class => "developer-title") %>
        <%= render :partial => "shared/stars_rank" if type != 'templates' %>
        <%= content_tag(:p, product.price.nil?.eql?(true) ? 'Free' : product.price, :class => "price-container") %>
      </div>
    </div>
  </div>
 <% end %>
<% end %>