Skip to content

Commit

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

<ul>
<% recipe.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>
<ul>
<% recipe.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 class="mb-3">
<%= form.label :name, style: "display: block" %>
<%= form.text_field :name, class: "form-control" %>
</div>

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

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

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

<div>
<%= form.label :public, style: "display: block" %>
<%= form.check_box :public %>
</div>
<div class="mb-3">
<%= form.label :public, style: "display: block" %>
<%= form.check_box :public %>
</div>

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

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

0 comments on commit 2e663eb

Please sign in to comment.