Skip to content

Commit

Permalink
ADDS: styles to Add food form
Browse files Browse the repository at this point in the history
  • Loading branch information
wayungi committed Nov 18, 2022
1 parent 44a26d3 commit a35e699
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 29 deletions.
64 changes: 36 additions & 28 deletions app/views/foods/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,33 +1,41 @@
<%= form_with(model: food) do |form| %>
<% if food.errors.any? %>
<div style="color: red">
<h2><%= pluralize(food.errors.count, "error") %> prohibited this food from being saved:</h2>
<section>
<%= form_with(model: food) do |form| %>
<% if food.errors.any? %>
<div style="color: red">
<h2><%= pluralize(food.errors.count, "error") %> prohibited this food from being saved:</h2>

<ul>
<% food.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>
<ul>
<% food.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>

<div >
<%= form.label :name, style: "display: block" %>
<%= form.text_field :name %>
</div>

<div>
<%= form.label :measurement_unit, style: "display: block" %>
<%= form.text_field :measurement_unit %>
</div>
<%# <div class='mb-3'>
<%= form.label :name, style: "display: block"
<%= form.text_field :name, class: "form-control"
</div> %>

<div>
<%= form.label :price, style: "display: block" %>
<%= form.text_field :price %>
</div>
<div class='mb-3'>
<%= form.label :name, style: "display: block" %>
<%= form.text_field :name, class: "form-control" %>
</div>

<div class='mb-3'>
<%= form.label :measurement_unit, style: "display: block" %>
<%= form.text_field :measurement_unit, class: "form-control" %>
</div>

<div>
<br/>
<%= form.submit class: "btn btn-primary"%>
</div>
<% end %>
<div class="mb-3">
<%= form.label :price, style: "display: block" %>
<%= form.text_field :price, class: "form-control" %>
</div>

<div>
<br/>
<%= form.submit class: "btn btn-primary"%>
</div>
<% end %>
</section>
2 changes: 1 addition & 1 deletion app/views/foods/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
<br>

<div>
<%= link_to "Back to foods", foods_path %>
<%= link_to "Back to foods", foods_path, class: "btn btn-success btn-lg"%>
</div>

0 comments on commit a35e699

Please sign in to comment.