added friends
This commit is contained in:
42
app/views/friends/_form.html.erb
Normal file
42
app/views/friends/_form.html.erb
Normal file
@ -0,0 +1,42 @@
|
||||
<%= form_with(model: friend, class: "contents") do |form| %>
|
||||
<% if friend.errors.any? %>
|
||||
<div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-md mt-3">
|
||||
<h2><%= pluralize(friend.errors.count, "error") %> prohibited this friend from being saved:</h2>
|
||||
|
||||
<ul class="list-disc ml-6">
|
||||
<% friend.errors.each do |error| %>
|
||||
<li><%= error.full_message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :firstname %>
|
||||
<%= form.text_field :firstname, class: [{"border-gray-400 focus:outline-blue-600": friend.errors[:firstname].none?, "border-red-400 focus:outline-red-600": friend.errors[:firstname].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :lastname %>
|
||||
<%= form.text_field :lastname, class: [{"border-gray-400 focus:outline-blue-600": friend.errors[:lastname].none?, "border-red-400 focus:outline-red-600": friend.errors[:lastname].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :email %>
|
||||
<%= form.text_field :email, class: [{"border-gray-400 focus:outline-blue-600": friend.errors[:email].none?, "border-red-400 focus:outline-red-600": friend.errors[:email].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :telefon %>
|
||||
<%= form.text_field :telefon, class: [{"border-gray-400 focus:outline-blue-600": friend.errors[:telefon].none?, "border-red-400 focus:outline-red-600": friend.errors[:telefon].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :level %>
|
||||
<%= form.number_field :level, class: [{"border-gray-400 focus:outline-blue-600": friend.errors[:level].none?, "border-red-400 focus:outline-red-600": friend.errors[:level].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="inline">
|
||||
<%= form.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user