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
|
||||
@products = Product.all
|
||||
@categories = Product.categories
|
||||
end
|
||||
|
||||
def edit
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in a new issue