Skip to content

Commit

Permalink
Modify recipe show view
Browse files Browse the repository at this point in the history
  • Loading branch information
tsheporamantso committed Feb 7, 2024
1 parent 8e57e7c commit e46b28e
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions app/views/recipes/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,28 @@
<h1><%= @recipe.name %></h1>
<div class="genral-detal">
<div class="details">
<p>Preparation time: <%= @recipe.preparation_time %></p>
<p>Cooking time: <%= @recipe.cooking_time %></p>
<p><%= @recipe.description %></p>
<%= form_with(model: @recipe, url: user_recipe_path(@user, @recipe), local: true, method: :patch) do |f| %>
<div>
<p><%= f.label :public %>
<label class="switch">
<%= f.hidden_field :public, value: false %>
<%= f.check_box :public, { onchange: 'this.form.submit()' }, true, false %>
<span class="slider"></span>
</label>
</p>
</div>
<% end %>
<h3>Preparation time: <%= @recipe.preparation_time %></h3>
<h3>Cooking time: <%= @recipe.cooking_time %></h3>
<h3><%= @recipe.description %></h3>
</div>
<div>
<%= form_with(model: @recipe, url: user_recipe_path(@user, @recipe), local: true, method: :patch) do |f| %>
<div>
<p><%= f.label :public %>
<label class="switch">
<%= f.hidden_field :public, value: false %>
<%= f.check_box :public, { onchange: 'this.form.submit()',
disabled: @user != current_user }, true, false %>
<span class="slider"></span>
</label>
</p>
</div>
<% end %>
</div>
</div>

<div class="btns">
<%= button_to "Generate Shopping List" %>
<%= link_to "Add ingredients", new_user_recipe_recipe_food_path(@user, @recipe), class: "add-btn" %>
</div>
<%= button_to "Generate Shopping List", class: "add-food-link"%>
<%= button_to "Add ingredients", new_user_recipe_recipe_food_path(@user, @recipe), class: "add-food-link",
method: :get, disabled: @recipe.user != current_user %>
</div>
</div>

0 comments on commit e46b28e

Please sign in to comment.