Tabs <3
This commit is contained in:
parent
e76a139205
commit
0b0d780e91
3 changed files with 20 additions and 4 deletions
|
@ -14,6 +14,7 @@ class ProductsController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@products = Product.all
|
@products = Product.all
|
||||||
|
@categories = Product.categories
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<li><%= link_to "List" , users_path %></li>
|
<li><%= link_to "List" , users_path %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><%= link_to 'Download schulden', admins_schulden_path(format: :csv) %>/li>
|
<li><%= link_to 'Download schulden', admins_schulden_path(format: :csv) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Logged in as <%= current_user.nickname %> <b class="caret"></b></a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Logged in as <%= current_user.nickname %> <b class="caret"></b></a>
|
||||||
|
|
|
@ -1,8 +1,23 @@
|
||||||
<h1>All products</h1>
|
<h1>All products</h1>
|
||||||
<%= render partial: 'flash' %>
|
<%= render partial: 'flash' %>
|
||||||
|
|
||||||
<div class="row products">
|
<div role="tabpanel">
|
||||||
<div class="col-md-12">
|
<!-- Nav tabs -->
|
||||||
<%= render @products %>
|
<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>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue