<div class="row">
  <div class="col-xs-12">
    <div class="page-header">
      <h1>Ingredients</h1>
    </div>

    <% if @ingredients.empty? %>
      <p>No Ingredients</p>
    <% else %>

      <table class="table table-condensed table-hover">
        <thead>
        <tr>
          <th>Name</th>
          <th>USDA NDBN</th>
          <th>KCal per 100g</th>
          <th>Density</th>
          <th></th>
        </tr>
        </thead>

        <tbody>
        <% @ingredients.each do |ingredient| %>
          <tr>
            <td><%= link_to ingredient.name, edit_ingredient_path(ingredient) %></td>
            <td><%= ingredient.ndbn %></td>
            <td><%= ingredient.kcal %></td>
            <td><%= ingredient.density %></td>
            <td>
              <%= link_to ingredient, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-sm 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>
