Skip to content

Commit

Permalink
ADDS: styles for recipes/new
Browse files Browse the repository at this point in the history
  • Loading branch information
wayungi committed Nov 18, 2022
1 parent f3933bf commit e6ca5eb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 25 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@import "bootstrap";

:root {
--azure: #000;
--azure: rgb(232, 203, 18);
--opaque-azure: #4386bf;
--dark-white: #e8e8e8;
--white-color: #fff;
Expand Down
51 changes: 28 additions & 23 deletions app/views/recipe_foods/_form.html.erb
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>
2 changes: 1 addition & 1 deletion app/views/recipe_foods/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<br>

<div>
<%= link_to "Show this recipe", @recipe %>
<%= link_to "Show this recipe", @recipe, class: "btn btn-success btn-lg"%>
</div>

0 comments on commit e6ca5eb

Please sign in to comment.