<div class="row">
  <div class="col-xs-12">

    <div class="page-header">
      <h1>Recipes</h1>
    </div>

    <% if @recipes.empty? %>
      <p>No Recipes</p>
    <% else %>

      <div class="table-responsive">
        <table class="table table-striped table-hover">
          <thead>
            <tr>
              <th>Name</th>
              <% if current_user? %>
                <th></th>
              <% end %>
              <th>Yields</th>
              <th>Time</th>
              <th>Created</th>
              <th>Modified</th>
            </tr>
          </thead>

          <tbody>
            <% @recipes.each do |recipe| %>
              <tr>
                <td><%= link_to recipe.display_name, recipe %></td>

                <% if current_user? %>
                  <td>
                    <%= link_to edit_recipe_path(recipe), class: 'btn btn-sm btn-primary' do %>
                      <span class="glyphicon glyphicon-pencil"></span>
                    <% end %>
                    <%= link_to recipe, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-sm btn-danger' do %>
                      <span class="glyphicon glyphicon-remove"></span>
                    <% end %>
                  </td>
                <% end %>

                <td><%= recipe.yields %></td>
                <td><%= recipe_time(recipe) %></td>
                <td><%= timestamp(recipe.created_at) %></td>
                <td><%= timestamp(recipe.updated_at) %></td>
              </tr>
            <% end %>
          </tbody>
        </table>
      </div>

    <% end %>

    <br>

    <%= link_to 'New Recipe', new_recipe_path, class: 'btn btn-default' %>

  </div>
</div>