parsley/app/views/recipes/index.html.erb
2016-07-27 22:30:57 -05:00

59 lines
1.8 KiB
Plaintext

<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>
<th>Yields</th>
<th>Time</th>
<th>Created</th>
<% if current_user? %>
<th></th>
<% end %>
</tr>
</thead>
<tbody>
<% decorate(@recipes, RecipeDecorator).each do |recipe| %>
<tr>
<td><%= link_to recipe.short_name, recipe %></td>
<td><%= recipe.yields %></td>
<td><%= recipe_time(recipe) %></td>
<td><%= timestamp(recipe.created_at) %></td>
<% if current_user? %>
<td>
<%= link_to new_recipe_log_path(recipe), class: 'btn btn-sm btn-primary' do %>
<span class="glyphicon glyphicon-copy"></span>
<% end %>
<%= 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 %>
</tr>
<% end %>
</tbody>
</table>
</div>
<% end %>
<br>
<%= link_to 'New Recipe', new_recipe_path, class: 'btn btn-default' %>
</div>
</div>