forked from VaneCode/recipe_app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
30 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,32 @@ | ||
<section> | ||
<%= form_with(model: recipe_food, url: recipe_recipe_foods_path(@recipe), method: :post) do |form| %> | ||
<% if recipe_food.errors.any? %> | ||
<div style="color: red"> | ||
<h2><%= pluralize(recipe_food.errors.count, "error") %> prohibited this recipe_food from being saved:</h2> | ||
|
||
<%= form_with(model: recipe_food, url: recipe_recipe_foods_path(@recipe), method: :post) do |form| %> | ||
<% if recipe_food.errors.any? %> | ||
<div style="color: red"> | ||
<h2><%= pluralize(recipe_food.errors.count, "error") %> prohibited this recipe_food from being saved:</h2> | ||
<ul> | ||
<% recipe_food.errors.each do |error| %> | ||
<li><%= error.full_message %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<ul> | ||
<% recipe_food.errors.each do |error| %> | ||
<li><%= error.full_message %></li> | ||
<% end %> | ||
</ul> | ||
<div class="mb-3"> | ||
<%= form.label :food_id, style: "display: block", class: "form-label" %> | ||
<%= form.select :food_id, @foods.map {|food| ["#{food.name} in #{food.measurement_unit}", food.id]}, {}, { class: 'form-select form-select-lg' } %> | ||
|
||
<div class= "mt-3" >If food not present you may <%= link_to 'Add New Food', action: :add_food %></div> | ||
</div> | ||
|
||
<div class="mb-3"> | ||
<%= form.label :quantity, style: "display: block", class: "form-label" %> | ||
<%= form.number_field :quantity, class: "form-control m-2 w-50"%> | ||
</div> | ||
<% end %> | ||
|
||
<div class="mb-3"> | ||
<%= form.label :food_id, style: "display: block", class: "form-label" %> | ||
<%= form.select :food_id, @foods.map {|food| ["#{food.name} in #{food.measurement_unit}", food.id]}, {}, { class: 'form-select form-select-lg' } %> | ||
If food not present you may <%= link_to 'Add New Food', action: :add_food %> | ||
</div> | ||
<div class="mb-3"> | ||
<%= form.label :quantity, style: "display: block", class: "form-label" %> | ||
<%= form.number_field :quantity, class: "form-control m-2 w-50"%> | ||
</div> | ||
<div> | ||
<%= form.submit %> | ||
</div> | ||
<% end %> | ||
<div> | ||
<%= form.submit class: 'btn btn-primary'%> | ||
</div> | ||
|
||
<% end %> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters