Added Category and User Passwort Change
This commit is contained in:
@@ -38,28 +38,7 @@
|
||||
|
||||
<div class="max-w-2xl mx-auto space-y-6">
|
||||
|
||||
<!-- DYNAMISCHE TAB-NAVIGATION -->
|
||||
<div class="border-b border-gray-200 mb-6">
|
||||
<nav class="flex space-x-6" aria-label="Tabs">
|
||||
<!-- Tab 1: Sicherheit (Inaktiv) -->
|
||||
<%= link_to edit_password_path, class: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 border-b-2 py-4 px-1 text-sm font-medium flex items-center gap-2 transition" do %>
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z" /></svg>
|
||||
Sicherheit
|
||||
<% end %>
|
||||
|
||||
<!-- Tab 2: Sitzungen & Geräte (Inaktiv) -->
|
||||
<%= link_to sessions_path, class: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 border-b-2 py-4 px-1 text-sm font-medium flex items-center gap-2 transition" do %>
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25" /></svg>
|
||||
Sitzungen & Geräte
|
||||
<% end %>
|
||||
|
||||
<!-- Tab 3: Aktivitäten (Aktiv) -->
|
||||
<span class="border-blue-500 text-blue-600 border-b-2 py-4 px-1 text-sm font-semibold flex items-center gap-2" aria-current="page">
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0z" /></svg>
|
||||
Aktivitäten
|
||||
</span>
|
||||
</nav>
|
||||
</div>
|
||||
<%= render "identity/account_tabs", active_tab: :activities %>
|
||||
|
||||
<!-- Info-Header -->
|
||||
<div class="bg-white border border-gray-200 rounded-xl shadow-sm p-6 flex flex-col sm:flex-row items-start sm:items-center gap-4 justify-between">
|
||||
|
||||
2
app/views/categories/_category.html.erb
Normal file
2
app/views/categories/_category.html.erb
Normal file
@@ -0,0 +1,2 @@
|
||||
<div id="<%= dom_id category %>" class="w-full sm:w-auto my-5 space-y-5">
|
||||
</div>
|
||||
2
app/views/categories/_category.json.jbuilder
Normal file
2
app/views/categories/_category.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.extract! category, :id, :created_at, :updated_at
|
||||
json.url category_url(category, format: :json)
|
||||
41
app/views/categories/_form.html.erb
Normal file
41
app/views/categories/_form.html.erb
Normal file
@@ -0,0 +1,41 @@
|
||||
<%= form_with(model: category, class: "space-y-6 max-w-2xl mx-auto bg-white border border-gray-200 rounded-xl shadow-sm p-6 md:p-8") do |form| %>
|
||||
|
||||
<% if category.errors.any? %>
|
||||
<div class="p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 border border-red-200" role="alert">
|
||||
<h2 class="font-bold mb-1"><%= pluralize(category.errors.count, "Fehler") %> verhinderten das Speichern:</h2>
|
||||
<ul class="list-disc list-inside text-xs">
|
||||
<% category.errors.full_messages.each do |message| %>
|
||||
<li><%= message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<h2 class="text-xl font-bold text-gray-800">Kategorie-Details</h2>
|
||||
<p class="text-sm text-gray-500 mt-1">Definiere eine übergeordnete Gruppe für dein Inventar (z.B. Laptops oder Bürostühle).</p>
|
||||
</div>
|
||||
|
||||
<hr class="border-gray-200">
|
||||
|
||||
<!-- Name -->
|
||||
<div>
|
||||
<%= form.label :name, "Name der Kategorie", class: "block text-sm font-medium mb-2 text-gray-700" %>
|
||||
<%= form.text_field :name, required: true, class: "py-2.5 px-4 block w-full border border-gray-300 rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 bg-gray-50/50", placeholder: "z.B. IT-Infrastruktur" %>
|
||||
</div>
|
||||
|
||||
<!-- Beschreibung -->
|
||||
<div>
|
||||
<%= form.label :description, "Beschreibung / Notizen", class: "block text-sm font-medium mb-2 text-gray-700" %>
|
||||
<%= form.text_area :description, rows: 4, class: "py-2.5 px-4 block w-full border border-gray-300 rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 bg-gray-50/50", placeholder: "Welche Art von Gegenständen fällt in diese Kategorie?..." %>
|
||||
</div>
|
||||
|
||||
<hr class="border-gray-200">
|
||||
|
||||
<!-- Buttons -->
|
||||
<div class="flex justify-end gap-x-3">
|
||||
<%= link_to "Abbrechen", categories_path, class: "py-2.5 px-4 inline-flex items-center text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition shadow-sm" %>
|
||||
<%= form.submit "Kategorie speichern", class: "py-2.5 px-4 inline-flex items-center text-sm font-semibold rounded-lg bg-blue-600 text-white hover:bg-blue-700 shadow-sm transition cursor-pointer" %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
14
app/views/categories/edit.html.erb
Normal file
14
app/views/categories/edit.html.erb
Normal file
@@ -0,0 +1,14 @@
|
||||
<% content_for :title, "Kategorie bearbeiten" %>
|
||||
|
||||
<div class="p-4 md:p-6 space-y-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>
|
||||
</div>
|
||||
44
app/views/categories/index.html.erb
Normal file
44
app/views/categories/index.html.erb
Normal file
@@ -0,0 +1,44 @@
|
||||
<!-- Ersetze den alten Button im Top-Bar-Yield durch diesen echten Link -->
|
||||
|
||||
<% content_for :title, "Inventar-Kategorien" %>
|
||||
|
||||
<div class="space-y-6">
|
||||
<!-- Header-Aktionen (Nutzt das Yield aus deinem Layout) -->
|
||||
<% content_for :top_bar_actions do %>
|
||||
<%= link_to new_category_path, class: "py-2 px-4 text-sm font-semibold rounded-lg bg-blue-600 text-white hover:bg-blue-700 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="M12 4.5v15m7.5-7.5h-15" /></svg>
|
||||
Kategorie erstellen
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<!-- Das Kachel-Grid -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
<% @categories.each do |category| %>
|
||||
<div class="bg-white border border-gray-200 rounded-xl p-6 shadow-sm hover:shadow-md transition flex flex-col justify-between">
|
||||
<div>
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<div class="p-2.5 bg-blue-50 text-blue-600 rounded-lg">
|
||||
<!-- Heroicon: folder -->
|
||||
<svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12.75V12A2.25 2.25 0 0 1 4.5 9.75h15A2.25 2.25 0 0 1 21.75 12v.75m-19.5 0A2.25 2.25 0 0 0 2.25 15v2.25m0-4.5A2.25 2.25 0 0 1 4.5 12h15a2.25 2.25 0 0 1 2.25 2.25m-19.5 0v4.5A2.25 2.25 0 0 0 4.5 21h15a2.25 2.25 0 0 0 2.25-2.25V15M2.25 12V6a2.25 2.25 0 0 1 2.25-2.25h2.25c.59 0 1.157.234 1.576.652L9.75 5.85a2.25 2.25 0 0 0 1.576.652h6.924a2.25 2.25 0 0 1 2.25 2.25v3.25" /></svg>
|
||||
</div>
|
||||
<!-- Dynamische Anzahl der Objekte im System -->
|
||||
<span class="inline-flex items-center py-1 px-2.5 rounded-full text-xs font-semibold bg-gray-100 text-gray-800 border border-gray-200">
|
||||
<%= category.items.count %> <%= category.items.count == 1 ? "Objekt" : "Objekte" %>
|
||||
</span>
|
||||
</div>
|
||||
<h3 class="text-base font-bold text-gray-800"><%= category.name %></h3>
|
||||
<p class="text-xs text-gray-500 mt-2 leading-relaxed"><%= category.description.presence || "Keine Beschreibung hinterlegt." %></p>
|
||||
</div>
|
||||
|
||||
<div class="mt-6 pt-4 border-t border-gray-100 flex justify-end gap-3 text-xs font-semibold">
|
||||
|
||||
<%= link_to "Bearbeiten", edit_category_path(category), class: "text-gray-500 hover:text-gray-700 transition" %>
|
||||
|
||||
<%= link_to category_path(category), class: "text-blue-600 hover:text-blue-800 flex items-center gap-0.5 transition" do %>
|
||||
Artikel ansehen →
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
1
app/views/categories/index.json.jbuilder
Normal file
1
app/views/categories/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @categories, partial: "categories/category", as: :category
|
||||
5
app/views/categories/new.html.erb
Normal file
5
app/views/categories/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<% content_for :title, "Neue Kategorie erstellen" %>
|
||||
|
||||
<div class="p-4 md:p-6">
|
||||
<%= render "form", category: @category %>
|
||||
</div>
|
||||
82
app/views/categories/show.html.erb
Normal file
82
app/views/categories/show.html.erb
Normal file
@@ -0,0 +1,82 @@
|
||||
<% content_for :title, "Kategorie: #{@category.name}" %>
|
||||
|
||||
<div class="space-y-6">
|
||||
<!-- Zurück-Link im Header -->
|
||||
<% 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 %>
|
||||
<!-- Heroicon: arrow-left -->
|
||||
<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>
|
||||
Alle Kategorien
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<!-- Beschreibungskarte -->
|
||||
<div class="bg-white border border-gray-200 rounded-xl p-6 shadow-sm">
|
||||
<h2 class="text-sm font-bold text-gray-400 uppercase tracking-wider">Beschreibung</h2>
|
||||
<p class="text-sm text-gray-600 mt-1 leading-relaxed"><%= @category.description.presence || "Keine Beschreibung hinterlegt für diese Kategorie." %></p>
|
||||
</div>
|
||||
|
||||
<!-- Tabelle der zugeordneten Artikel -->
|
||||
<div class="bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden">
|
||||
<div class="px-6 py-4 border-b border-gray-200 bg-gray-50">
|
||||
<h3 class="font-bold text-gray-700 text-sm">Registrierte Unikate in dieser Kategorie</h3>
|
||||
</div>
|
||||
|
||||
<% if @items.any? %>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="min-w-full divide-y divide-gray-200 text-sm">
|
||||
<thead class="bg-gray-50/50">
|
||||
<tr>
|
||||
<th class="px-6 py-3 text-start font-semibold text-gray-500 uppercase tracking-wider">Artikel / Modell</th>
|
||||
<th class="px-6 py-3 text-start font-semibold text-gray-500 uppercase tracking-wider">Seriennummer (SN)</th>
|
||||
<th class="px-6 py-3 text-start font-semibold text-gray-500 uppercase tracking-wider">Aktueller Standort / Inhaber</th>
|
||||
<th class="px-6 py-3 text-start font-semibold text-gray-500 uppercase tracking-wider">QR-ID</th>
|
||||
<th class="px-6 py-3 text-end font-semibold text-gray-500 uppercase tracking-wider">Wert</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 bg-white">
|
||||
<% @items.each do |item| %>
|
||||
<tr class="hover:bg-gray-50/50 transition">
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="font-semibold text-gray-900"><%= item.name %></div>
|
||||
<div class="text-xs text-gray-400">SKU: <%= item.sku %></div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap font-mono text-xs text-gray-600">
|
||||
<%= item.serial_number %>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-gray-700">
|
||||
<!-- Deine saubere Variante-2-Weiche für Inhaber vs. Raum -->
|
||||
<% if item.user.present? %>
|
||||
<span class="inline-flex items-center gap-1 text-gray-900 font-medium">
|
||||
👤 <%= item.user.name %>
|
||||
</span>
|
||||
<% elsif item.room.present? %>
|
||||
<span class="inline-flex items-center gap-1 text-gray-600">
|
||||
📍 <%= item.room.name_with_building %>
|
||||
</span>
|
||||
<% else %>
|
||||
<span class="inline-flex items-center py-0.5 px-2 rounded-full text-xs font-medium bg-amber-50 text-amber-800 border border-amber-200">
|
||||
📦 Im Hauptlager
|
||||
</span>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap font-mono text-xs font-bold text-blue-600">
|
||||
#<%= item.sticker_id %>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-end font-medium text-gray-900">
|
||||
<%= number_to_currency(item.price, unit: "€", separator: ",", delimiter: ".", format: "%n %u") %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<% else %>
|
||||
<!-- Empty State -->
|
||||
<div class="text-center py-12 text-gray-400">
|
||||
<svg class="mx-auto h-12 w-12 text-gray-300" fill="none" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z" /></svg>
|
||||
<p class="text-sm mt-2">Bisher sind keine Artikel in dieser Kategorie registriert.</p>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
1
app/views/categories/show.json.jbuilder
Normal file
1
app/views/categories/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "categories/category", category: @category
|
||||
81
app/views/identity/_account_tabs.html.erb
Normal file
81
app/views/identity/_account_tabs.html.erb
Normal file
@@ -0,0 +1,81 @@
|
||||
|
||||
<!-- 1. MOBILE ANSICHT: Ein sauberes Dropdown-Menü (Sichtbar auf Handys, versteckt ab 'sm:') -->
|
||||
<div class="sm:hidden">
|
||||
<label for="mobile-account-tabs" class="sr-only">Navigationsbereich wechseln</label>
|
||||
<select id="mobile-account-tabs"
|
||||
onchange="window.location.href = this.value"
|
||||
class="block w-full rounded-lg border-gray-300 bg-white py-2.5 px-3 text-sm font-medium text-gray-700 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
||||
|
||||
<option value="<%= edit_password_path %>" <%= 'selected' if active_tab == :security %>>
|
||||
🔒 Sicherheit
|
||||
</option>
|
||||
<option value="<%= edit_identity_email_path %>" <%= 'selected' if active_tab == :email %>>
|
||||
✉️ E-Mail-Adresse
|
||||
</option>
|
||||
<option value="<%= sessions_path %>" <%= 'selected' if active_tab == :sessions %>>
|
||||
💻 Sitzungen & Geräte
|
||||
</option>
|
||||
<option value="<%= authentications_events_path %>" <%= 'selected' if active_tab == :activities %>>
|
||||
📊 Aktivitäten
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- 2. DESKTOP ANSICHT: Die klassische Tab-Leiste (Versteckt auf Mobilgeräten, sichtbar ab 'sm:') -->
|
||||
<div class="hidden sm:block border-b border-gray-200 mb-6 overflow-x-auto">
|
||||
<nav class="flex space-x-6 min-w-max" aria-label="Tabs">
|
||||
|
||||
<!-- Tab 1: Sicherheit (Passwort) -->
|
||||
<% if active_tab == :security %>
|
||||
<span class="border-blue-500 text-blue-600 border-b-2 py-4 px-1 text-sm font-semibold flex items-center gap-2">
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z" /></svg>
|
||||
Sicherheit
|
||||
</span>
|
||||
<% else %>
|
||||
<%= link_to edit_password_path, class: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 border-b-2 py-4 px-1 text-sm font-medium flex items-center gap-2 transition" do %>
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z" /></svg>
|
||||
Sicherheit
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<!-- Tab 2: E-Mail-Adresse -->
|
||||
<% if active_tab == :email %>
|
||||
<span class="border-blue-500 text-blue-600 border-b-2 py-4 px-1 text-sm font-semibold flex items-center gap-2">
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0l-7.5-4.615a2.25 2.25 0 0 1-1.07-1.916V6.75" /></svg>
|
||||
E-Mail-Adresse
|
||||
</span>
|
||||
<% else %>
|
||||
<%= link_to edit_identity_email_path, class: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 border-b-2 py-4 px-1 text-sm font-medium flex items-center gap-2 transition" do %>
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0l-7.5-4.615a2.25 2.25 0 0 1-1.07-1.916V6.75" /></svg>
|
||||
E-Mail-Adresse
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<!-- Tab 3: Sitzungen & Geräte -->
|
||||
<% if active_tab == :sessions %>
|
||||
<span class="border-blue-500 text-blue-600 border-b-2 py-4 px-1 text-sm font-semibold flex items-center gap-2">
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25" /></svg>
|
||||
Sitzungen & Geräte
|
||||
</span>
|
||||
<% else %>
|
||||
<%= link_to sessions_path, class: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 border-b-2 py-4 px-1 text-sm font-medium flex items-center gap-2 transition" do %>
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25" /></svg>
|
||||
Sitzungen & Geräte
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<!-- Tab 4: Aktivitäten -->
|
||||
<% if active_tab == :activities %>
|
||||
<span class="border-blue-500 text-blue-600 border-b-2 py-4 px-1 text-sm font-semibold flex items-center gap-2">
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0z" /></svg>
|
||||
Aktivitäten
|
||||
</span>
|
||||
<% else %>
|
||||
<%= link_to authentications_events_path, class: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 border-b-2 py-4 px-1 text-sm font-medium flex items-center gap-2 transition" do %>
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0z" /></svg>
|
||||
Aktivitäten
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
@@ -1,4 +1,4 @@
|
||||
<p style="color: red"><%= alert %></p>
|
||||
<!--<p style="color: red"><%= alert %></p>
|
||||
|
||||
<% if Current.user.verified? %>
|
||||
<h1>Change your email</h1>
|
||||
@@ -41,3 +41,70 @@
|
||||
<div>
|
||||
<%= link_to "Back", root_path %>
|
||||
</div>
|
||||
-->
|
||||
<% content_for :title, "E-Mail-Adresse ändern" %>
|
||||
|
||||
<div class="max-w-2xl mx-auto space-y-6">
|
||||
|
||||
<%= render "identity/account_tabs", active_tab: :email %>
|
||||
|
||||
<!-- Info-Header -->
|
||||
<div class="bg-white border border-gray-200 rounded-xl shadow-sm p-6 flex flex-col sm:flex-row items-start sm:items-center gap-4">
|
||||
<div class="p-3 bg-blue-50 text-blue-600 rounded-lg shrink-0">
|
||||
<svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0l-7.5-4.615a2.25 2.25 0 0 1-1.07-1.916V6.75" />
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
<h2 class="text-lg font-bold text-gray-800">E-Mail-Adresse aktualisieren</h2>
|
||||
<p class="text-sm text-gray-500">Ändere deine primäre Login-Adresse. Aus Sicherheitsgründen musst du diese Aktion mit deinem Passwort bestätigen.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= form_with(url: identity_email_path, method: :patch, class: "bg-white border border-gray-200 rounded-xl shadow-sm p-6 md:p-8 space-y-6") do |form| %>
|
||||
<!-- Fehleranzeige bei falschem Passwort oder ungültiger Mail -->
|
||||
<% if Current.user.errors.any? %>
|
||||
<div class="p-4 text-sm text-red-800 rounded-lg bg-red-50 border border-red-200" role="alert">
|
||||
<h3 class="font-bold mb-1">Fehler beim Aktualisieren:</h3>
|
||||
<ul class="list-disc list-inside text-xs">
|
||||
<% Current.user.errors.full_messages.each do |message| %>
|
||||
<li><%= message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- Feld 1: Neue E-Mail-Adresse -->
|
||||
<div>
|
||||
<%= form.label :email, "Neue E-Mail-Adresse", class: "block text-sm font-medium mb-1.5 text-gray-700" %>
|
||||
<div class="relative rounded-md shadow-sm">
|
||||
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
||||
<svg class="h-5 w-5 text-gray-400" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0l-7.5-4.615a2.25 2.25 0 0 1-1.07-1.916V6.75" />
|
||||
</svg>
|
||||
</div>
|
||||
<%= form.email_field :email, value: Current.user.email, required: true, autofocus: true, autocomplete: "email", class: "block w-full pl-10 pr-3 py-2.5 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-gray-50/50" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Feld 2: Passwort zur Bestätigung -->
|
||||
<div>
|
||||
<%= form.label :password_challenge, "Aktuelles Passwort zur Bestätigung", class: "block text-sm font-medium mb-1.5 text-gray-700" %>
|
||||
<div class="relative rounded-md shadow-sm">
|
||||
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
||||
<svg class="h-5 w-5 text-gray-400" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25z" />
|
||||
</svg>
|
||||
</div>
|
||||
<%= form.password_field :password_challenge, required: true, autocomplete: "current-password", class: "block w-full pl-10 pr-3 py-2.5 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-gray-50/50" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="border-gray-200">
|
||||
|
||||
<!-- Abschicken-Button -->
|
||||
<div class="flex justify-end">
|
||||
<%= form.submit "E-Mail-Adresse speichern", class: "py-2.5 px-5 text-sm font-semibold rounded-lg bg-blue-600 text-white hover:bg-blue-700 shadow-sm transition cursor-pointer" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
<span class="collapse-text ml-3 transition-all duration-300 ease-in-out max-w-[180px] opacity-100 overflow-hidden whitespace-nowrap">Wareneingang</span>
|
||||
<% end %>
|
||||
|
||||
<%= link_to "", class: nav_link_class("categories") do %>
|
||||
<%= link_to categories_path, class: nav_link_class("categories") do %>
|
||||
<svg class="h-5 w-5 shrink-0 ml-0.5" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621 Clyde5.04 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z" /></svg>
|
||||
<span class="collapse-text ml-3 transition-all duration-300 ease-in-out max-w-[180px] opacity-100 overflow-hidden whitespace-nowrap">Kategorien</span>
|
||||
<% end %>
|
||||
|
||||
@@ -47,29 +47,8 @@
|
||||
|
||||
<div class="max-w-2xl mx-auto space-y-6">
|
||||
|
||||
<!-- INTERNE PROFIL-NAVIGATION (Tabs) -->
|
||||
<div class="border-b border-gray-200">
|
||||
<nav class="flex space-x-6" aria-label="Tabs">
|
||||
<!-- Aktiver Tab: Profil & Sicherheit -->
|
||||
<span class="border-blue-500 text-blue-600 border-b-2 py-4 px-1 text-sm font-semibold flex items-center gap-2">
|
||||
<!-- Heroicon: user -->
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z" /></svg>
|
||||
Sicherheit
|
||||
</span>
|
||||
<!-- Link zur Sitzungsübersicht von authentication-zero -->
|
||||
<%= link_to sessions_path, class: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 border-b-2 py-4 px-1 text-sm font-medium flex items-center gap-2 transition" do %>
|
||||
<!-- Heroicon: computer-desktop -->
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25" /></svg>
|
||||
Sitzungen & Geräte
|
||||
<% end %>
|
||||
<%= link_to authentications_events_path, class: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 border-b-2 py-4 px-1 text-sm font-medium flex items-center gap-2 transition" do %>
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0z" /></svg>
|
||||
Aktivitäten
|
||||
<% end %>
|
||||
<%= render "identity/account_tabs", active_tab: :security %>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<!-- Sektion 1: Benutzerdaten (Schreibgeschützt) -->
|
||||
<div class="bg-white border border-gray-200 rounded-xl shadow-sm p-6 md:p-8">
|
||||
<div class="flex items-center gap-4 mb-4">
|
||||
|
||||
@@ -38,29 +38,7 @@
|
||||
|
||||
<div class="max-w-2xl mx-auto space-y-6">
|
||||
|
||||
|
||||
<div class="border-b border-gray-200 mb-6">
|
||||
<nav class="flex space-x-6" aria-label="Tabs">
|
||||
<!-- Inaktiv verlinkt -->
|
||||
|
||||
<%= link_to edit_password_path, class: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 border-b-2 py-4 px-1 text-sm font-medium flex items-center gap-2 transition" do %>
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z" /></svg>
|
||||
Sicherheit
|
||||
<% end %>
|
||||
|
||||
<!-- Aktiv -->
|
||||
<span class="border-blue-500 text-blue-600 border-b-2 py-4 px-1 text-sm font-semibold flex items-center gap-2">
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25" /></svg>
|
||||
Sitzungen & Geräte
|
||||
</span>
|
||||
<!-- Diesen Link fügst du einfach in die Navigationsleisten der anderen beiden Views ein -->
|
||||
<%= link_to authentications_events_path, class: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 border-b-2 py-4 px-1 text-sm font-medium flex items-center gap-2 transition" do %>
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0z" /></svg>
|
||||
Aktivitäten
|
||||
<% end %>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<%= render "identity/account_tabs", active_tab: :sessions %>
|
||||
|
||||
<!-- Info-Header -->
|
||||
<div class="bg-white border border-gray-200 rounded-xl shadow-sm p-6 flex flex-col sm:flex-row items-start sm:items-center gap-4 justify-between">
|
||||
|
||||
Reference in New Issue
Block a user