More layout adjustments and more dry refactor
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / system-test (push) Has been cancelled

This commit is contained in:
2026-05-30 03:02:31 +02:00
parent d8c6a7ab82
commit 2931314cd1
10 changed files with 111 additions and 112 deletions

View File

@@ -1,6 +1,14 @@
<!-- app/views/categories/_form.html.erb -->
<%= form_with(model: category, class: "space-y-6") do |form| %>
<%= form_with(model: category, class: "space-y-6 max-w-4xl mx-auto bg-white border border-gray-200 rounded-xl shadow-sm p-6 md:p-8") do |form| %>
<%= render "layouts/form_header",
model: @category,
new_title: "Kategorie anlegen",
new_description: "Definiere einen neuen Hardware-Typ für deine Bestandsliste.",
edit_title: "Kategorie bearbeiten",
edit_description: "Aktualisiere die Bezeichnung oder die Notizen dieser Kategorie." %>
<hr class="border-gray-200">
<%= render "layouts/form_errors", model: category %>
<!-- KATEGORIENAME INPUT -->

View File

@@ -1,14 +1,21 @@
<% content_for :title, "Kategorie bearbeiten" %>
<div class="p-4 md:p-6 space-y-6">
<% content_for :top_bar_actions do %>
<%= link_to categories_path, class: "py-2 px-3 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 flex items-center gap-1.5 shadow-sm transition" do %>
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18" /></svg>
<div class="hidden md:inline">
Zurück zur Übersicht
</div>
<% end %>
<% end %>
<div class="space-y-6 p-4 md:p-6">
<%= render "form", category: @category %>
<!-- Gefahrenbereich: Kategorie löschen (Nur wenn keine Items drin sind) -->
<div class="max-w-2xl mx-auto bg-red-50/50 border border-red-200 rounded-xl p-6 flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4">
<div>
<h3 class="text-sm font-bold text-red-800">Kategorie löschen</h3>
<p class="text-xs text-red-600 mt-0.5">Dies kann nicht rückgängig gemacht werden. Nur möglich, wenn die Kategorie komplett leer ist.</p>
</div>
<%= link_to "Löschen", @category, data: { turbo_method: :delete, turbo_confirm: "Möchtest du diese Kategorie wirklich unwiderruflich löschen?" }, class: "py-2 px-3 text-xs font-semibold text-white bg-red-600 hover:bg-red-700 rounded-lg shadow-sm transition" %>
</div>
<%= render "layouts/danger_zone",
title: "Kategorie löschen",
description: "Das Löschen einer Kategorie entfernt diesen Typ dauerhaft. Alle zugeordneten Artikel müssen danach neu kategorisiert werden.",
button_text: "Kategorie löschen",
confirm_message: "Möchtest du diese Kategorie wirklich löschen? Alle Artikel dieses Typs verlieren ihre Kategorie.",
path: category_path(@category) %>
</div>

View File

@@ -1,7 +1,7 @@
<% content_for :title, "Kategorien anlegen" %>
<% content_for :top_bar_actions do %>
<%= link_to rooms_path, class: "py-2 px-3 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 flex items-center gap-1.5 shadow-sm transition" do %>
<%= link_to categories_path, class: "py-2 px-3 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 flex items-center gap-1.5 shadow-sm transition" do %>
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18" /></svg>
<div class="hidden md:inline">
Zurück zur Übersicht
@@ -9,22 +9,7 @@
<% end %>
<% end %>
<div class="max-w-xl mx-auto mt-4">
<div class="bg-white border border-gray-200 rounded-xl shadow-sm p-4 md:p-6">
<div class="flex items-center gap-3 mb-6 pb-4 border-b border-gray-100 text-gray-500">
<div class="p-2 bg-blue-50 text-blue-600 rounded-lg border border-blue-100">
<svg class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
</svg>
</div>
<div>
<h3 class="font-bold text-gray-900 text-base">Kategorie erstellen</h3>
<p class="text-xs text-gray-400">Definiere einen neuen Hardware-Typ für deine Bestandsliste.</p>
</div>
</div>
<%= render "form", category: @category %>
</div>
<div class="p-4 md:p-6">
<%= render "form", category: @category %>
</div>