Skip to content

Commit

Permalink
feat: add recipe food view to add food items to the recipe as ingredi…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
demesameneshoa committed Dec 20, 2023
1 parent cfabbdf commit 86addd2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions app/views/recipe_foods/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<h1 id = "form-title", class = "text-center text-muted m-2">Add new Food to Recipe</h1>
<%= form_with(model: [@recipe_food], url: recipe_foods_path) do |form| %>
<div class="d-flex justify-content-center gap-2 w-100">
<div class="field">
<%= form.hidden_field :recipe_id, value: @recipe_id %>
</div>
<div class="field">
<%= form.label :name %><br>
<%= form.collection_select(:food_id, Food.all, :id, :name, { prompt: "Select a Food" }, { class: "form-select" }) %>
</div>

<div class="field">
<%= form.label :quantity %><br>
<%= form.number_field :quantity, autofocus: true, autocomplete: "quantity", placeholder: "Quantity" %>
</div>
<div class="text-center">
<%= form.submit 'Add Food to Recipe', class: "btn btn-primary mt-3"%>
</div>
</div>
<% end %>

0 comments on commit 86addd2

Please sign in to comment.