Quelltext des aktuellen Standes
<?php $this->layout('layouts/admin', [
'page_title' => 'Seiten-Vorlagen',
'current_admin_page' => 'page-templates',
]); ?>
<?php $templates = $templates ?? []; ?>
<div class="settings-page">
<!-- Neue Vorlage erstellen -->
<section class="settings-card">
<div class="settings-card-header">
<span class="settings-card-icon">✚</span>
<div>
<h2><?= $this->te('Neue Vorlage erstellen') ?></h2>
<p class="settings-card-desc"><?= $this->te('Erstellen Sie eine neue Seitenvorlage für die Dokumentation.') ?></p>
</div>
</div>
<div class="settings-card-body">
<form action="/admin/page-templates" method="POST" class="form">
<input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">
<div class="form-row-2">
<div class="form-group">
<label for="new-name"><?= $this->te('Name') ?></label>
<input type="text" id="new-name" name="name" class="form-control" placeholder="<?= $this->te('z.B. Drucker-Dokumentation') ?>" required maxlength="255">
</div>
<div class="form-group">
<label for="new-category"><?= $this->te('Kategorie') ?></label>
<input type="text" id="new-category" name="category" class="form-control" placeholder="<?= $this->te('z.B. Infrastruktur') ?>" value="Allgemein">
</div>
</div>
<div class="form-row-2">
<div class="form-group">
<label for="new-icon"><?= $this->te('Icon') ?></label>
<select id="new-icon" name="icon" class="form-control icon-select">
<option value="📄" selected><?= $this->te('📄 Dokument') ?></option>
<option value="🖥"><?= $this->te('🖥 Server') ?></option>
<option value="💻"><?= $this->te('💻 Laptop') ?></option>
<option value="🖨"><?= $this->te('🖨 PC') ?></option>
<option value="🌐"><?= $this->te('🌐 Netzwerk') ?></option>
<option value="🔒"><?= $this->te('🔒 Sicherheit') ?></option>
<option value="🔐"><?= $this->te('🔐 Schlüssel') ?></option>
<option value="🔧"><?= $this->te('🔧 Werkzeug') ?></option>
<option value="⚙"><?= $this->te('⚙ Zahnrad') ?></option>
<option value="🔌"><?= $this->te('🔌 Stecker') ?></option>
<option value="📡"><?= $this->te('📡 Fax/Drucker') ?></option>
<option value="✉"><?= $this->te('✉ E-Mail') ?></option>
<option value="📞"><?= $this->te('📞 Telefon') ?></option>
<option value="📱"><?= $this->te('📱 Smartphone') ?></option>
<option value="☁"><?= $this->te('☁ Cloud') ?></option>
<option value="📊"><?= $this->te('📊 Diagramm') ?></option>
<option value="📈"><?= $this->te('📈 Statistik') ?></option>
<option value="📋"><?= $this->te('📋 Checkliste') ?></option>
<option value="📝"><?= $this->te('📝 Notiz') ?></option>
<option value="📚"><?= $this->te('📚 Buecher') ?></option>
<option value="🔍"><?= $this->te('🔍 Suche') ?></option>
<option value="🔗"><?= $this->te('🔗 Link') ?></option>
<option value="🎮"><?= $this->te('🎮 Steuerung') ?></option>
<option value="🛠"><?= $this->te('🛠 Wartung') ?></option>
<option value="🚀"><?= $this->te('🚀 Rakete') ?></option>
<option value="⚠"><?= $this->te('⚠ Warnung') ?></option>
<option value="🚨"><?= $this->te('🚨 Alarm') ?></option>
<option value="✅"><?= $this->te('✅ Erledigt') ?></option>
<option value="❌"><?= $this->te('❌ Fehler') ?></option>
<option value="👤"><?= $this->te('👤 Person') ?></option>
<option value="👥"><?= $this->te('👥 Team') ?></option>
<option value="🏢"><?= $this->te('🏢 Firma') ?></option>
<option value="💰"><?= $this->te('💰 Finanzen') ?></option>
<option value="📅"><?= $this->te('📅 Kalender') ?></option>
<option value="🕑"><?= $this->te('🕑 Uhr') ?></option>
<option value="💾"><?= $this->te('💾 Datenbank') ?></option>
<option value="📦"><?= $this->te('📦 Paket') ?></option>
<option value="📑"><?= $this->te('📑 Formular') ?></option>
<option value="💡"><?= $this->te('💡 Idee') ?></option>
<option value="🎯"><?= $this->te('🎯 Ziel') ?></option>
</select>
</div>
<div class="form-group" style="align-self:flex-end;">
<button type="submit" class="btn btn-primary"><?= $this->te('Vorlage erstellen') ?></button>
</div>
</div>
</form>
</div>
</section>
<!-- Vorlagen-Liste -->
<section class="settings-card">
<div class="settings-card-header">
<span class="settings-card-icon">📋</span>
<div>
<h2><?= $this->t('Alle Vorlagen') ?> (<?= count($templates) ?>)</h2>
<p class="settings-card-desc"><?= $this->te('Vorlagen für neue Dokumentationsseiten verwalten.') ?></p>
</div>
</div>
<div class="settings-card-body" style="padding:0;">
<?php if (empty($templates)): ?>
<div style="padding:2rem;text-align:center;color:var(--color-text-muted,var(--gray-500));">
<p><?= $this->te('Noch keine Vorlagen vorhanden.') ?></p>
<p style="font-size:0.85rem;"><?= $this->te('Fuehren Sie die Datenbank-Migration aus oder erstellen Sie eine neue Vorlage.') ?></p>
</div>
<?php else: ?>
<div class="admin-table-wrap">
<table class="tpl-table">
<thead>
<tr>
<th scope="col" style="width:48px;"></th>
<th scope="col"><?= $this->te('Name') ?></th>
<th scope="col" class="tpl-col-hide-sm"><?= $this->te('Kategorie') ?></th>
<th scope="col" class="tpl-col-hide-md"><?= $this->te('Beschreibung') ?></th>
<th scope="col" class="tpl-col-hide-sm" style="width:70px;"><?= $this->te('Reihenf.') ?></th>
<th scope="col" style="width:70px;"><?= $this->te('Status') ?></th>
<th scope="col" style="width:130px;"><?= $this->te('Aktionen') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($templates as $tpl): ?>
<tr>
<td style="font-size:1.25rem;text-align:center;"><?= $tpl['icon'] ?></td>
<td><strong><?= $this->e($tpl['name']) ?></strong></td>
<td class="tpl-col-hide-sm"><span class="tpl-cat-badge"><?= $this->e($tpl['category']) ?></span></td>
<td class="tpl-col-hide-md" style="color:var(--color-text-muted,var(--gray-500));font-size:0.85rem;"><?= $this->e($this->truncate($tpl['description'] ?? '', 60)) ?></td>
<td class="tpl-col-hide-sm" style="text-align:center;"><?= $tpl['sort_order'] ?></td>
<td>
<?php if ($tpl['is_active']): ?>
<span class="tpl-status-active"><?= $this->te('Aktiv') ?></span>
<?php else: ?>
<span class="tpl-status-inactive"><?= $this->te('Inaktiv') ?></span>
<?php endif; ?>
</td>
<td>
<div style="display:flex;gap:0.375rem;">
<a href="/admin/page-templates/<?= $tpl['id'] ?>/edit" class="btn btn-sm btn-secondary"><?= $this->te('Bearbeiten') ?></a>
<form action="/admin/page-templates/<?= $tpl['id'] ?>" method="POST" style="margin:0;" onsubmit="return confirm('Vorlage wirklich löschen?')">
<input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">
<input type="hidden" name="_method" value="DELETE">
<button aria-label="<?= $this->te('Löschen') ?>" type="submit" class="btn btn-sm btn-danger-outline">×</button>
</form>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
</section>
</div>
<style>
.tpl-table {
width: 100%;
border-collapse: collapse;
font-size: var(--font-size-sm, 0.875rem);
}
.tpl-table th,
.tpl-table td {
padding: 0.625rem 0.75rem;
text-align: left;
border-bottom: 1px solid var(--color-border, var(--gray-200));
}
.tpl-table th {
background: var(--color-bg-alt, var(--gray-50));
font-weight: 600;
font-size: var(--font-size-xs, 0.75rem);
text-transform: uppercase;
color: var(--color-text-muted, var(--gray-500));
letter-spacing: 0.025em;
}
.tpl-table tbody tr:hover {
background: var(--color-bg-hover, var(--gray-50));
}
.tpl-cat-badge {
display: inline-block;
padding: 0.125rem 0.5rem;
border-radius: 9999px;
font-size: 0.7rem;
font-weight: 600;
background: var(--color-bg-alt, var(--gray-200));
color: var(--color-text, var(--gray-700));
}
.tpl-status-active {
display: inline-block;
padding: 0.125rem 0.5rem;
border-radius: 9999px;
font-size: 0.65rem;
font-weight: 600;
background: var(--green-100);
color: var(--green-800);
text-transform: uppercase;
}
.tpl-status-inactive {
display: inline-block;
padding: 0.125rem 0.5rem;
border-radius: 9999px;
font-size: 0.65rem;
font-weight: 600;
background: var(--gray-100);
color: var(--gray-400);
text-transform: uppercase;
}
.btn-danger-outline {
background: none;
border: 1px solid var(--red-600);
color: var(--red-600);
font-weight: 600;
font-size: 1rem;
line-height: 1;
cursor: pointer;
border-radius: var(--radius, 0.375rem);
padding: 0.25rem 0.5rem;
transition: all 0.15s;
}
.btn-danger-outline:hover {
background: var(--red-600);
color: var(--color-on-accent);
}
.form-row-2 {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1rem;
}
@media (max-width: 640px) {
.form-row-2 {
grid-template-columns: 1fr;
}
}
.icon-select {
font-size: 1.1rem;
max-width: 220px;
padding: 0.375rem 0.5rem;
}
@media (max-width: 640px) {
.tpl-col-hide-sm { display: none; }
}
@media (max-width: 900px) {
.tpl-col-hide-md { display: none; }
}
</style>