- added parties
- changed layout for index and added svgs
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
<%= 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>
|
||||
@ -37,6 +35,6 @@
|
||||
</div>
|
||||
|
||||
<div class="inline">
|
||||
<%= form.submit %>
|
||||
<%= form.submit 'Speichern' %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
<div id="<%= dom_id friend %>" class="w-full sm:w-auto my-5 space-y-5">
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Firstname:</strong>
|
||||
<%= friend.firstname %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Lastname:</strong>
|
||||
<%= friend.lastname %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Email:</strong>
|
||||
<%= friend.email %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Telefon:</strong>
|
||||
<%= friend.telefon %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Level:</strong>
|
||||
<%= friend.level %>
|
||||
</div>
|
||||
</div>
|
||||
@ -5,6 +5,5 @@
|
||||
|
||||
<%= render "form", friend: @friend %>
|
||||
|
||||
<%= link_to "Anzeigen", @friend, class: "btn-show" %>
|
||||
<%= link_to "Liste", friends_path, class: "btn-show" %>
|
||||
<%= link_to "Übersicht", friends_path, class: "btn-show" %>
|
||||
</div>
|
||||
|
||||
@ -7,43 +7,40 @@
|
||||
|
||||
<div class="flex justify-between items-center">
|
||||
<h1 class="font-bold text-4xl">Freunde</h1>
|
||||
<%= link_to "Neuer Freund", new_friend_path, class: "btn-new" %>
|
||||
<%= link_to "+", new_friend_path, class: "rounded-md px-3 py-2 bg-slate-800 hover:bg-green-500 text-white block font-medium" %>
|
||||
</div>
|
||||
|
||||
<table class="w-full">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>E-Mail</th>
|
||||
<th>Telefon</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @friends.each do | friend | %>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="friends" class="min-w-full divide-y divide-gray-200 space-y-5">
|
||||
<% if @friends.any? %>
|
||||
<% @friends.each do |friend| %>
|
||||
<div class="flex flex-col sm:flex-row justify-between items-center pb-5 sm:pb-0">
|
||||
<%= render friend %>
|
||||
<div class="w-full sm:w-auto flex flex-col sm:flex-row space-x-2 space-y-2">
|
||||
<%= link_to "Anzeigen", friend, class: "btn-show" %>
|
||||
<%= link_to "Bearbeiten", edit_friend_path(friend), class: "btn-show" %>
|
||||
<%= button_to "Löschen", friend, method: :delete, class: "btn-destroy", data: { turbo_confirm: "Sind Sie sich sicher?" } %>
|
||||
</div>
|
||||
<div id="parties" class="mt-10 min-w-full divide-y divide-gray-200 space-y-5">
|
||||
<% @friends.each do |friend| %>
|
||||
<div class="py-2 flex items-center justify-between hover:bg-gray-50">
|
||||
<div>
|
||||
<p class="text-lg font-semibold relative">
|
||||
<%= friend.fullname %>
|
||||
<span class="m-2 -top-2 absolute text-[10px] bg-green-400 text-white rounded-full p-0.5">
|
||||
12
|
||||
</span>
|
||||
</p>
|
||||
<p class="text-gray-600 text-sm">
|
||||
<%= mail_to friend.email, "Mail: #{friend.email}" %>,
|
||||
<%= phone_to friend.telefon, "Tel: #{friend.telefon}" %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<p class="text-center my-10">Bisher kein Freund eingegeben.</p>
|
||||
|
||||
<div class="flex space-x-3">
|
||||
<%= link_to edit_friend_path(friend),
|
||||
class: "hover:bg-green-400 hover:text-white font-medium rounded border px-2 py-1" do %>
|
||||
<svg class="h-6 w-6 " fill="currentColor" clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m11.239 15.533c-1.045 3.004-1.238 3.451-1.238 3.84 0 .441.385.627.627.627.272 0 1.108-.301 3.829-1.249zm.888-.888 3.22 3.22 6.408-6.401c.163-.163.245-.376.245-.591 0-.213-.082-.427-.245-.591-.58-.579-1.458-1.457-2.039-2.036-.163-.163-.377-.245-.591-.245-.213 0-.428.082-.592.245zm-3.127-.895c0-.402-.356-.75-.75-.75-2.561 0-2.939 0-5.5 0-.394 0-.75.348-.75.75s.356.75.75.75h5.5c.394 0 .75-.348.75-.75zm5-3c0-.402-.356-.75-.75-.75-2.561 0-7.939 0-10.5 0-.394 0-.75.348-.75.75s.356.75.75.75h10.5c.394 0 .75-.348.75-.75zm0-3c0-.402-.356-.75-.75-.75-2.561 0-7.939 0-10.5 0-.394 0-.75.348-.75.75s.356.75.75.75h10.5c.394 0 .75-.348.75-.75zm0-3c0-.402-.356-.75-.75-.75-2.561 0-7.939 0-10.5 0-.394 0-.75.348-.75.75s.356.75.75.75h10.5c.394 0 .75-.348.75-.75z" fill-rule="nonzero"/></svg>
|
||||
<% end %>
|
||||
|
||||
<%= button_to friend_path(friend),
|
||||
method: :delete,
|
||||
data: { confirm: "Löschen?" },
|
||||
class: "hover:bg-red-400 hover:text-white font-medium rounded border px-2 py-1" do %>
|
||||
<svg class="h-6 w-6 " fill="currentColor" clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m4.015 5.494h-.253c-.413 0-.747-.335-.747-.747s.334-.747.747-.747h5.253v-1c0-.535.474-1 1-1h4c.526 0 1 .465 1 1v1h5.254c.412 0 .746.335.746.747s-.334.747-.746.747h-.254v15.435c0 .591-.448 1.071-1 1.071-2.873 0-11.127 0-14 0-.552 0-1-.48-1-1.071zm14.5 0h-13v15.006h13zm-4.25 2.506c-.414 0-.75.336-.75.75v8.5c0 .414.336.75.75.75s.75-.336.75-.75v-8.5c0-.414-.336-.75-.75-.75zm-4.5 0c-.414 0-.75.336-.75.75v8.5c0 .414.336.75.75.75s.75-.336.75-.75v-8.5c0-.414-.336-.75-.75-.75zm3.75-4v-.5h-3v.5z" fill-rule="nonzero"/></svg>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -3,5 +3,6 @@
|
||||
<div class="md:w-2/3 w-full">
|
||||
<h1 class="font-bold text-4xl">Neuer Freund</h1>
|
||||
<%= render "form", friend: @friend %>
|
||||
<%= link_to "Back to friends", friends_path, class: "btn-empty" %>
|
||||
|
||||
<%= link_to "Übersicht", friends_path, class: "btn-empty" %>
|
||||
</div>
|
||||
|
||||
@ -7,8 +7,6 @@
|
||||
|
||||
<h1 class="font-bold text-4xl">Freund anzeigen</h1>
|
||||
|
||||
<%= render @friend %>
|
||||
|
||||
<%= link_to "Bearbeiten", edit_friend_path(@friend), class: "btn-show" %>
|
||||
<%= link_to "Liste anzeigen", friends_path, class: "btn-show" %>
|
||||
<%= button_to "Löschen", @friend, method: :delete, form_class: "sm:inline-block mt-2 sm:mt-0 sm:ml-2",
|
||||
|
||||
Reference in New Issue
Block a user