-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from beteland123/food_list
Food list, shopping view
- Loading branch information
Showing
11 changed files
with
3,397 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,4 @@ | |
|
||
# Ignore master key for decrypting credentials and more. | ||
/config/master.key | ||
node_modules/ |
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
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<h1>General Shopping List</h1> | ||
|
||
<% if @missing_food_items.any? %> | ||
<p>Amount of food to buy: <%= @total_food_items %></p> | ||
<p>Total value of food need: <%= @total_price %></p> | ||
<ul> | ||
<% @missing_food_items.each do |item| %> | ||
<li> | ||
Food Name: <%= item[:food_name] %><br> | ||
Quantity Needed: <%= item[:quantity_needed] %><br> | ||
Price: <%= item[:price] %> | ||
</li> | ||
<% end %> | ||
</ul> | ||
|
||
|
||
<% else %> | ||
<p>No missing food items.</p> | ||
<% end %> |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<h1>New Food</h1> | ||
<div class="container"> | ||
<%= form_with model: @food, url: foods_path, method: :post, local: true do |f| %> | ||
<div> | ||
<%= f.label :name %> | ||
<%= f.text_field :name, placeholder: "Chicken breasts" %> | ||
</div> | ||
<div> | ||
<%= f.label :measurement_unit %> | ||
<%= f.select :measurement_unit, options_for_select(["grams", "ounces", "pounds", "kilograms", "milligrams","Unit"]), placeholder: "Select a measurement unit" %> | ||
</div> | ||
<div> | ||
<%= f.label :price, "Price in $" %> | ||
<%= f.text_field :price, placeholder: "$ Enter the price" %> | ||
</div> | ||
<div> | ||
<%= f.submit "Add food" %> | ||
</div> | ||
<% end %> | ||
</div> |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<h1 class="title">Edit recipe food</h1> | ||
|
||
<div> | ||
<%= form_with model: @recipe_food, url: recipe_recipe_food_path(@recipe.id, @recipe_food.id), class: "form-container", method: :patch do |f| %> | ||
<div > | ||
<%= f.label :quantity %> | ||
<%= f.number_field :quantity, placeholder: 'New Quantity', min: 0 %> | ||
</div> | ||
<div> | ||
<%= f.submit 'Update quantity' %> | ||
</div> | ||
<% end %> | ||
</div> |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<div class='container'> | ||
<h2>Add a new ingredient</h2> | ||
<%= form_with(model: [@recipe, @recipe_food], url: recipe_recipe_foods_path(@recipe), local: true) do |f| %> | ||
|
||
<div class='field'> | ||
<%= f.label :food_id, 'Select food item' %> | ||
<%= f.collection_select(:food_id, available_foods, :id, :name, {}, {}) %> | ||
</div> | ||
<div class='field'> | ||
<%= f.label :quantity %> | ||
<%= f.text_field :quantity %> | ||
</div> | ||
|
||
<%= form.hidden_field :recipe_id, value: recipe.id %> | ||
|
||
<div> | ||
<%= form.submit "Add ingredient" %> | ||
</div> | ||
<% end %> | ||
</div> |
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
Oops, something went wrong.