From e6ca5eb11d6a63a2bb69975e450392541be3922e Mon Sep 17 00:00:00 2001 From: wayungi Date: Fri, 18 Nov 2022 12:35:57 +0300 Subject: [PATCH] ADDS: styles for recipes/new --- app/assets/stylesheets/application.scss | 2 +- app/views/recipe_foods/_form.html.erb | 51 ++++++++++++++----------- app/views/recipe_foods/new.html.erb | 2 +- 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index bb0000f..fbb7673 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -15,7 +15,7 @@ @import "bootstrap"; :root { - --azure: #000; + --azure: rgb(232, 203, 18); --opaque-azure: #4386bf; --dark-white: #e8e8e8; --white-color: #fff; diff --git a/app/views/recipe_foods/_form.html.erb b/app/views/recipe_foods/_form.html.erb index 2b10a41..3cc2d6f 100644 --- a/app/views/recipe_foods/_form.html.erb +++ b/app/views/recipe_foods/_form.html.erb @@ -1,27 +1,32 @@ +
+ <%= form_with(model: recipe_food, url: recipe_recipe_foods_path(@recipe), method: :post) do |form| %> + <% if recipe_food.errors.any? %> +
+

<%= pluralize(recipe_food.errors.count, "error") %> prohibited this recipe_food from being saved:

-<%= form_with(model: recipe_food, url: recipe_recipe_foods_path(@recipe), method: :post) do |form| %> - <% if recipe_food.errors.any? %> -
-

<%= pluralize(recipe_food.errors.count, "error") %> prohibited this recipe_food from being saved:

+
    + <% recipe_food.errors.each do |error| %> +
  • <%= error.full_message %>
  • + <% end %> +
+
+ <% end %> -
    - <% recipe_food.errors.each do |error| %> -
  • <%= error.full_message %>
  • - <% end %> -
+
+ <%= 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 %>
+
+ +
+ <%= form.label :quantity, style: "display: block", class: "form-label" %> + <%= form.number_field :quantity, class: "form-control m-2 w-50"%>
- <% end %> -
- <%= 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 %> -
-
- <%= form.label :quantity, style: "display: block", class: "form-label" %> - <%= form.number_field :quantity, class: "form-control m-2 w-50"%> -
-
- <%= form.submit %> -
-<% end %> +
+ <%= form.submit class: 'btn btn-primary'%> +
+ + <% end %> +
diff --git a/app/views/recipe_foods/new.html.erb b/app/views/recipe_foods/new.html.erb index b8b4763..6f5d26d 100644 --- a/app/views/recipe_foods/new.html.erb +++ b/app/views/recipe_foods/new.html.erb @@ -5,5 +5,5 @@
- <%= link_to "Show this recipe", @recipe %> + <%= link_to "Show this recipe", @recipe, class: "btn btn-success btn-lg"%>