diet_help/app/views/products/index.html.erb

58 lines
2.3 KiB
Plaintext

<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Produkty</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
Listing Products (<%= link_to 'New Product', new_product_path %>)
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="dataTable_wrapper">
<p id="notice"><%= notice %></p>
<table class="table table-striped table-bordered table-hover" id="dataTables-example">
<thead>
<tr>
<th>Name</th>
<th>Product group</th>
<th>Kcal</th>
<th>Measure</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @products.each do |product| %>
<tr>
<td><%= product.name %></td>
<td><%= product.product_group.name %></td>
<td><%= product.kcal %></td>
<td><%= product.measure %></td>
<td><%= link_to raw('<i class="fa fa-eye"></i> Pokaz'), product, :class => "btn btn-success btn-xs" %></td>
<td><%= link_to raw('<i class="fa fa-edit"></i> Edytuj'), edit_product_path(product), :class => "btn btn-info btn-xs" %></td>
<td><%= link_to raw('<i class="fa fa-trash-o"></i> Usuń'), product, method: :delete, data: { confirm: 'Are you sure?' }, :class => "btn btn-danger btn-xs" %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
<!-- /.col-lg-12 -->
</div>
<%= javascript_include_tag 'dataTables.bootstrap.min', 'jquery.dataTables.min' %>
<script>
$(document).ready(function() {
$('#dataTables-example').DataTable({
responsive: true
});
});
</script>