parsley/app/views/ingredients/index.html.erb

51 lines
1.3 KiB
Plaintext

<div class="row">
<div class="col-xs-12">
<div class="page-header">
<h1>Ingredients</h1>
</div>
<% if @ingredients.empty? %>
<p>No Ingredients</p>
<% else %>
<%= link_to 'New Ingredient', new_ingredient_path, class: 'btn btn-default' %>
<br/>
<table class="table table-condensed table-hover">
<thead>
<tr>
<th>Name</th>
<th>USDA</th>
<th>KCal per 100g</th>
<th>Density (oz/cup)</th>
<th></th>
</tr>
</thead>
<tbody>
<% decorate(@ingredients, IngredientDecorator).each do |ingredient| %>
<tr>
<td><%= link_to ingredient.name, edit_ingredient_path(ingredient) %></td>
<td><%= ingredient.ndbn_check %></td>
<td><%= ingredient.kcal %></td>
<td><%= ingredient.density %></td>
<td>
<%= link_to ingredient, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-xs btn-danger' do %>
<span class="glyphicon glyphicon-remove"></span>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<br/>
<%= link_to 'New Ingredient', new_ingredient_path, class: 'btn btn-default' %>
</div>
</div>