tap/app/views/products/index.html.erb
2014-12-11 12:41:53 +01:00

27 lines
832 B
Text

<h1>All products</h1>
<%= render partial: 'flash' %>
<div role="tabpanel">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<% @categories.each do |o, i| %>
<li role="presentation"<% if i.zero? %> class="active"<% end %>><a href="#<%= o %>" aria-controls="<%= o %>" role="tab" data-toggle="tab"><%= o.titleize %></a></li>
<% end %>
<li role="presentation"><a href="#all" role="tab" data-toggle="tab">All</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<br />
<% @categories.each do |o, i| %>
<div role="tabpanel" class="tab-pane<% if i.zero? %> active<% end %>" id="<%= o %>">
<%= render @products.where(category: i) %>
</div>
<% end %>
<div role="tabpanel" class="tab-pane" id="all">
<%= render @products %>
</div>
</div>
</div>