Skip to content

Commit

Permalink
AMEND: Adds step+ingredients display partial
Browse files Browse the repository at this point in the history
  • Loading branch information
catchingash committed Jul 31, 2015
1 parent 9fa40f0 commit 5b3eed4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions app/views/steps/_display_step_with_ingredients.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<li class="preparation_step list-unstyled">

<% if step.has_measurements? %>
<ul class="list-unstyled text-muted">
<% step.measurements.each do |measurement| %>
<li class="ingredients_line"><%= measurement.amount %> <%= link_to measurement.ingredient.name, ingredient_path(measurement.ingredient) %></li>
<% end %>
</ul>
<% end %>

<%= step.directions %>
<% if recipe.owner?(session[:user_id]) && params[:recipe_id].nil? %>
<ul class="list-unstyled">
<li>
<%= link_to "Edit Step", edit_recipe_step_path(recipe, step), class: "btn btn-default" %>
</li>
<li>
<%= button_to "Delete Step", recipe_step_path(recipe, step),
method: :delete, data: { confirm: "Are you 100% sure you want to delete this step? The associated ingredients will also be removed from the recipe!" },
class: "btn btn-danger" %>
</li>
</ul>
<% end %>

</li>

0 comments on commit 5b3eed4

Please sign in to comment.