This commit is contained in:
Tom Naessens 2014-12-10 22:06:36 +01:00
parent e76a139205
commit 0b0d780e91
3 changed files with 20 additions and 4 deletions

View file

@ -14,6 +14,7 @@ class ProductsController < ApplicationController
def index
@products = Product.all
@categories = Product.categories
end
def edit

View file

@ -40,7 +40,7 @@
<li><%= link_to "List" , users_path %></li>
</ul>
</li>
<li><%= link_to 'Download schulden', admins_schulden_path(format: :csv) %>/li>
<li><%= link_to 'Download schulden', admins_schulden_path(format: :csv) %></li>
<% end %>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Logged in as <%= current_user.nickname %> <b class="caret"></b></a>

View file

@ -1,8 +1,23 @@
<h1>All products</h1>
<%= render partial: 'flash' %>
<div class="row products">
<div class="col-md-12">
<%= render @products %>
<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 %>
</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>
</div>