- added parties

- changed layout for index and added svgs
This commit is contained in:
2025-11-22 19:35:58 +01:00
parent d6623598a1
commit c9bf64dc8c
16 changed files with 100 additions and 130 deletions

View File

@ -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>