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

97 lines
3.3 KiB
Plaintext
Raw Normal View History

2016-01-12 18:43:00 -06:00
<div class="row">
<div class="col-xs-12">
2016-01-14 15:22:15 -06:00
<div class="page-header">
2016-01-18 12:58:54 -06:00
<h1>Recipes</h1>
2016-01-14 15:22:15 -06:00
</div>
2016-01-12 18:43:00 -06:00
<% if current_user? %>
<%= link_to 'New Recipe', new_recipe_path, class: 'btn btn-default' %><br/>
<% end %>
2016-01-12 18:43:00 -06:00
<%= paginate @recipes %>
<%= form_for(@criteria, as: :criteria, url: recipes_path, method: :get, html: {id: 'search_form'}) do |f| %>
<%= f.hidden_field :sort_column %>
<%= f.hidden_field :sort_direction %>
<%= f.hidden_field :page %>
<%= f.hidden_field :per %>
<%= f.hidden_field :name %>
<%= f.hidden_field :tags %>
<% end %>
<div class="table-responsive">
<table class="recipe-table table table-striped table-hover">
<thead>
<tr>
<th><%= index_sort_header('Name', :name, @criteria) %></th>
<th>Tags</th>
<th><%= index_sort_header('Rating', :rating, @criteria) %></th>
<th>Yields</th>
<th><%= index_sort_header('Time', :total_time, @criteria) %></th>
<th><%= index_sort_header('Created', :created_at, @criteria) %></th>
<th></th>
</tr>
<tr>
<th><%= text_field_tag('name_search', @criteria.name) %></th>
<th><%= text_field_tag('tags_search', @criteria.tags) %></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th><button id="recipe_index_search_button" class="btn btn-sm btn-default">Search</button></th>
</tr>
</thead>
2016-09-28 17:08:43 -05:00
<tbody>
<% decorate(@recipes, RecipeDecorator).each do |recipe| %>
2016-01-12 18:43:00 -06:00
<tr>
<td><%= link_to recipe.short_name, recipe %></td>
2017-04-24 11:57:34 -05:00
<td><div class="table_tags"><%= recipe.tag_names %></div></td>
<td>
<% if recipe.rating %>
<%= text_field_tag('rating', recipe.rating, disabled: true, data: {rating: true, size: '20px', interval: '0.25'}) %>
<% else %>
--
<% end %>
</td>
<td><%= recipe.yields %></td>
<td><%= recipe_time(recipe) %></td>
2017-04-24 11:57:34 -05:00
<td><%= recipe.created_at %></td>
2016-01-18 15:10:25 -06:00
<td>
2016-01-19 17:43:52 -06:00
<% if current_user? %>
2017-05-08 11:20:04 -05:00
<div class="recipe_list_controls">
<%= link_to new_recipe_log_path(recipe), class: 'btn btn-xs btn-primary' do %>
<span class="glyphicon glyphicon-copy"></span>
<% end %>
<%= link_to edit_recipe_path(recipe), class: 'btn btn-xs btn-primary' do %>
<span class="glyphicon glyphicon-pencil"></span>
<% end %>
<%= link_to recipe, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-xs btn-danger' do %>
<span class="glyphicon glyphicon-remove"></span>
<% end %>
</div>
2016-01-19 17:43:52 -06:00
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
2016-09-28 17:08:43 -05:00
<% if @recipes.empty? %>
<p>No Recipes</p>
2016-01-12 18:43:00 -06:00
<% end %>
<%= paginate @recipes %>
2016-01-12 18:43:00 -06:00
<br>
2017-02-21 12:57:56 -06:00
<% if current_user? %>
<%= link_to 'New Recipe', new_recipe_path, class: 'btn btn-default' %><br/>
<% end %>
2016-01-12 18:43:00 -06:00
</div>
</div>