Implement non-destructive Remove & Archive lifecycle system across assets, locations, tags, and shortlinks
This commit is contained in:
1 parent
3391257f6c
commit
960c375557
20 files changed
+1751
-185
No files matched your search
@@ -100,5 +100,42 @@
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<!-- QR Code Preview Modal -->
|
||||
<div id="qr-modal-overlay" style="display:none; position:fixed; inset:0; z-index:9999; background:rgba(0,0,0,0.55); backdrop-filter:blur(4px); justify-content:center; align-items:center;">
|
||||
<div id="qr-modal-card" style="background:var(--color-bg-surface, #fff); border-radius:16px; padding:2.5rem 2rem 2rem; max-width:380px; width:90%; box-shadow:0 24px 48px -12px rgba(0,0,0,0.25); display:flex; flex-direction:column; align-items:center; gap:1.25rem; position:relative; animation:qrModalIn 0.25s cubic-bezier(0.16,1,0.3,1);">
|
||||
<button onclick="closeQRModal()" style="position:absolute; top:0.75rem; right:0.75rem; background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--color-text-light); line-height:1;" aria-label="Close">×</button>
|
||||
<h3 style="font-weight:700; font-size:1.15rem; color:var(--color-text-main); margin:0;">QR Code Preview</h3>
|
||||
<img id="qr-modal-image" src="" alt="QR Code" style="width:220px; height:220px; border:1px solid var(--color-border); border-radius:8px; background:#fff; padding:8px;">
|
||||
<code id="qr-modal-link" style="font-family:monospace; background:var(--color-bg-base, #f5f5f5); padding:0.4rem 0.85rem; border-radius:6px; border:1px solid var(--color-border); font-weight:600; font-size:0.95rem; word-break:break-all; text-align:center;"></code>
|
||||
<a id="qr-modal-download" download="" href="" class="btn btn-primary" style="width:100%; font-size:0.9rem; text-align:center;">Download QR Image</a>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
@keyframes qrModalIn {
|
||||
from { opacity:0; transform:scale(0.92) translateY(12px); }
|
||||
to { opacity:1; transform:scale(1) translateY(0); }
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function openQRModal(slug, name) {
|
||||
var overlay = document.getElementById('qr-modal-overlay');
|
||||
document.getElementById('qr-modal-image').src = '/admin/qr/' + slug;
|
||||
document.getElementById('qr-modal-link').textContent = '/s/' + slug;
|
||||
var dl = document.getElementById('qr-modal-download');
|
||||
dl.href = '/admin/qr/' + slug;
|
||||
dl.download = (name || slug) + '_QR.png';
|
||||
overlay.style.display = 'flex';
|
||||
}
|
||||
function closeQRModal() {
|
||||
document.getElementById('qr-modal-overlay').style.display = 'none';
|
||||
}
|
||||
document.addEventListener('click', function(e) {
|
||||
if (e.target && e.target.id === 'qr-modal-overlay') closeQRModal();
|
||||
});
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Escape') closeQRModal();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -943,12 +943,18 @@
|
||||
{{end}}
|
||||
</select>
|
||||
|
||||
<label style="display: flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; font-weight: 500; cursor: pointer; white-space: nowrap; margin: 0 0.5rem;">
|
||||
<input type="checkbox" name="show_removed" value="1" {{if .ShowRemoved}}checked{{end}} onchange="this.form.submit()">
|
||||
Show removed
|
||||
</label>
|
||||
|
||||
<button type="submit" class="btn btn-secondary">Filter</button>
|
||||
{{if or .SearchQuery (or .SelectedStatus .SelectedLocation)}}
|
||||
{{if or .SearchQuery (or .SelectedStatus (or .SelectedLocation .ShowRemoved))}}
|
||||
<a href="/admin" class="btn btn-secondary" style="padding: 0.625rem;">Reset</a>
|
||||
{{end}}
|
||||
</form>
|
||||
|
||||
|
||||
<!-- Assets Inventory Table -->
|
||||
<div class="card" style="padding: 0;">
|
||||
<div class="data-table-wrapper">
|
||||
@@ -967,11 +973,11 @@
|
||||
<tbody>
|
||||
{{if .Items}}
|
||||
{{range .Items}}
|
||||
<tr>
|
||||
<tr class="{{if eq .LifecycleState "removed"}}lifecycle-removed{{else if eq .LifecycleState "archived"}}lifecycle-archived{{end}}">
|
||||
<td style="text-align: center; vertical-align: middle;">
|
||||
{{if .ShortSlug}}
|
||||
<a href="/admin/qr/{{.ShortSlug}}" target="_blank">
|
||||
<img src="/admin/qr/{{.ShortSlug}}" alt="QR Label" style="width: 42px; height: 42px; border: 1px solid var(--color-border); padding: 1px; border-radius: 4px; background: white;">
|
||||
<a href="javascript:void(0)" onclick="openQRModal('{{.ShortSlug}}', '{{.Name}}')">
|
||||
<img src="/admin/qr/{{.ShortSlug}}" alt="QR Label" style="width: 42px; height: 42px; border: 1px solid var(--color-border); padding: 1px; border-radius: 4px; background: white; cursor: pointer;">
|
||||
</a>
|
||||
{{else}}
|
||||
<span style="color: var(--color-text-light); font-size: 0.75rem;">--</span>
|
||||
@@ -997,9 +1003,13 @@
|
||||
{{end}}
|
||||
</td>
|
||||
<td>
|
||||
<span class="status-pill {{if eq .Status "In Use"}}in-use{{else if eq .Status "In Storage"}}in-storage{{else if eq .Status "Borrowed"}}borrowed{{else if eq .Status "Lost"}}lost{{else}}disposed{{end}}">
|
||||
{{.Status}}
|
||||
</span>
|
||||
{{if eq .LifecycleState "archived"}}
|
||||
<span class="status-pill archived">Archived</span>
|
||||
{{else}}
|
||||
<span class="status-pill {{if eq .Status "In Use"}}in-use{{else if eq .Status "In Storage"}}in-storage{{else if eq .Status "Borrowed"}}borrowed{{else if eq .Status "Lost"}}lost{{else}}disposed{{end}}">
|
||||
{{.Status}}
|
||||
</span>
|
||||
{{end}}
|
||||
</td>
|
||||
<td style="font-weight: 600; font-size: 0.95rem; color: var(--color-text-muted); text-align: center;">
|
||||
{{.Quantity}}
|
||||
@@ -1011,20 +1021,56 @@
|
||||
{{end}}
|
||||
</div>
|
||||
</td>
|
||||
<td style="text-align: right;">
|
||||
<td class="actions-cell" style="text-align: right;">
|
||||
<div style="display: inline-flex; gap: 0.5rem; align-items: center;">
|
||||
<a href="/admin?view={{.ID}}" class="btn btn-secondary" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Details
|
||||
</a>
|
||||
<a href="/admin/items/edit/{{.ID}}" class="btn btn-secondary" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Edit
|
||||
</a>
|
||||
<form action="/admin/items/delete/{{.ID}}" method="POST" onsubmit="return confirm('Are you sure you want to delete this asset? This cannot be undone.')" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="btn btn-danger" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Delete
|
||||
</button>
|
||||
</form>
|
||||
{{if eq .LifecycleState "removed"}}
|
||||
<!-- Soft removed item actions -->
|
||||
<form action="/admin/items/restore/{{.ID}}" method="POST" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="btn btn-secondary" style="padding: 0.35rem 0.65rem; font-size: 0.8rem; border-color: #10b981; color: #10b981;">
|
||||
Restore
|
||||
</button>
|
||||
</form>
|
||||
<form action="/admin/items/permanent-delete/{{.ID}}" method="POST" onsubmit="return confirm('Are you sure you want to permanently delete this asset? This will clean up all associated media files on disk and cannot be undone.')" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="btn btn-danger" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Delete Forever
|
||||
</button>
|
||||
</form>
|
||||
{{else}}
|
||||
<!-- Active or Archived item actions -->
|
||||
<a href="/admin?view={{.ID}}" class="btn btn-secondary" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Details
|
||||
</a>
|
||||
|
||||
{{if ne .LifecycleState "archived"}}
|
||||
<a href="/admin/items/edit/{{.ID}}" class="btn btn-secondary" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Edit
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
<div class="actions-dropdown">
|
||||
<button class="btn btn-danger" onclick="toggleActionsDropdown(this, event)" style="padding: 0.35rem 0.65rem; font-size: 0.8rem; display: inline-flex; align-items: center; gap: 0.25rem;">
|
||||
Delete <span style="font-size: 0.65rem;">▼</span>
|
||||
</button>
|
||||
<div class="actions-dropdown-menu">
|
||||
<form action="/admin/items/remove/{{.ID}}" method="POST" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="actions-dropdown-item text-danger">
|
||||
🗑 Remove Item
|
||||
</button>
|
||||
</form>
|
||||
{{if ne .LifecycleState "archived"}}
|
||||
<form action="/admin/items/archive/{{.ID}}" method="POST" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="actions-dropdown-item text-warning">
|
||||
📦 Archive Item
|
||||
</button>
|
||||
</form>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -8,6 +8,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form action="/admin/locations" method="GET" class="filter-bar" style="margin-bottom: 1.5rem; justify-content: flex-end;">
|
||||
{{if .EditingLocation}}
|
||||
<input type="hidden" name="edit" value="{{.EditingLocation.ID}}">
|
||||
{{end}}
|
||||
<label style="display: flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; font-weight: 500; cursor: pointer; white-space: nowrap;">
|
||||
<input type="checkbox" name="show_removed" value="1" {{if .ShowRemoved}}checked{{end}} onchange="this.form.submit()">
|
||||
Show removed locations
|
||||
</label>
|
||||
</form>
|
||||
|
||||
|
||||
<div class="detail-grid">
|
||||
<!-- Left Column: Locations List -->
|
||||
<div class="detail-main">
|
||||
@@ -25,8 +36,13 @@
|
||||
<tbody>
|
||||
{{if .Locations}}
|
||||
{{range .Locations}}
|
||||
<tr>
|
||||
<td style="font-weight: 600; color: var(--color-brand-primary);">{{.Name}}</td>
|
||||
<tr class="{{if eq .LifecycleState "removed"}}lifecycle-removed{{else if eq .LifecycleState "archived"}}lifecycle-archived{{end}}">
|
||||
<td style="font-weight: 600; color: var(--color-brand-primary);">
|
||||
{{.Name}}
|
||||
{{if eq .LifecycleState "archived"}}
|
||||
<span class="status-pill archived" style="margin-left: 0.5rem; font-size: 0.7rem; padding: 0.1rem 0.4rem;">Archived</span>
|
||||
{{end}}
|
||||
</td>
|
||||
<td>
|
||||
{{if .ParentName.Valid}}
|
||||
<span style="color: var(--color-text-muted); font-size: 0.9rem;">
|
||||
@@ -37,21 +53,53 @@
|
||||
{{end}}
|
||||
</td>
|
||||
<td style="color: var(--color-text-muted); font-size: 0.9rem;">{{.Description}}</td>
|
||||
<td style="text-align: right;">
|
||||
<div style="display: inline-flex; gap: 0.5rem;">
|
||||
<!-- Edit Location triggers loading edit state in the right-side form -->
|
||||
<a href="/admin/locations?edit={{.ID}}" class="btn btn-secondary" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Edit
|
||||
</a>
|
||||
{{if ne .ID 1}}
|
||||
<form action="/admin/locations/delete/{{.ID}}" method="POST" onsubmit="return confirm('Are you sure you want to delete this location? Sub-locations and assets will be detached.')" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="btn btn-danger" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Delete
|
||||
</button>
|
||||
</form>
|
||||
{{else}}
|
||||
<td class="actions-cell" style="text-align: right;">
|
||||
<div style="display: inline-flex; gap: 0.5rem; align-items: center;">
|
||||
{{if eq .ID 1}}
|
||||
<span style="color: var(--color-text-light); font-size: 0.8rem; font-style: italic; padding: 0.35rem 0.65rem;">Locked</span>
|
||||
{{else if eq .LifecycleState "removed"}}
|
||||
<!-- Soft removed actions -->
|
||||
<form action="/admin/locations/restore/{{.ID}}" method="POST" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="btn btn-secondary" style="padding: 0.35rem 0.65rem; font-size: 0.8rem; border-color: #10b981; color: #10b981;">
|
||||
Restore
|
||||
</button>
|
||||
</form>
|
||||
<form action="/admin/locations/permanent-delete/{{.ID}}" method="POST" onsubmit="return confirm('Are you sure you want to permanently delete this location? Associated sub-locations and assets will be detached.')" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="btn btn-danger" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Delete Forever
|
||||
</button>
|
||||
</form>
|
||||
{{else}}
|
||||
<!-- Active / Archived actions -->
|
||||
{{if ne .LifecycleState "archived"}}
|
||||
<a href="/admin/locations?edit={{.ID}}&show_removed={{if $.ShowRemoved}}1{{else}}0{{end}}" class="btn btn-secondary" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Edit
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
<div class="actions-dropdown">
|
||||
<button class="btn btn-danger" onclick="toggleActionsDropdown(this, event)" style="padding: 0.35rem 0.65rem; font-size: 0.8rem; display: inline-flex; align-items: center; gap: 0.25rem;">
|
||||
Delete <span style="font-size: 0.65rem;">▼</span>
|
||||
</button>
|
||||
<div class="actions-dropdown-menu">
|
||||
<form action="/admin/locations/remove/{{.ID}}" method="POST" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="actions-dropdown-item text-danger">
|
||||
🗑 Remove
|
||||
</button>
|
||||
</form>
|
||||
{{if ne .LifecycleState "archived"}}
|
||||
<form action="/admin/locations/archive/{{.ID}}" method="POST" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="actions-dropdown-item text-warning">
|
||||
📦 Archive
|
||||
</button>
|
||||
</form>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -7,6 +7,15 @@
|
||||
<p>Manage custom manual redirects (e.g. warranties, external manuals) or review auto-generated asset short URLs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<form action="/admin/shortener" method="GET" class="filter-bar" style="margin-bottom: 1.5rem; justify-content: flex-end;">
|
||||
{{if .EditingLink}}
|
||||
<input type="hidden" name="edit" value="{{.EditingLink.ID}}">
|
||||
{{end}}
|
||||
<label style="display: flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; font-weight: 500; cursor: pointer; white-space: nowrap;">
|
||||
<input type="checkbox" name="show_removed" value="1" {{if .ShowRemoved}}checked{{end}} onchange="this.form.submit()">
|
||||
Show removed links
|
||||
</label>
|
||||
</form>
|
||||
|
||||
<div class="detail-grid">
|
||||
<!-- Left Column: Links List -->
|
||||
@@ -26,14 +35,19 @@
|
||||
<tbody>
|
||||
{{if .Links}}
|
||||
{{range .Links}}
|
||||
<tr>
|
||||
<tr class="{{if eq .LifecycleState "removed"}}lifecycle-removed{{else if eq .LifecycleState "archived"}}lifecycle-archived{{end}}">
|
||||
<td>
|
||||
<div style="display: flex; flex-direction: column; gap: 0.15rem;">
|
||||
<a href="/s/{{.Slug}}" target="_blank" style="font-weight: 700; color: var(--color-brand-primary); text-decoration: none;">
|
||||
/s/{{.Slug}}
|
||||
</a>
|
||||
<div style="display: flex; align-items: center; gap: 0.35rem;">
|
||||
<a href="/s/{{.Slug}}" target="_blank" style="font-weight: 700; color: var(--color-brand-primary); text-decoration: none;">
|
||||
/s/{{.Slug}}
|
||||
</a>
|
||||
{{if eq .LifecycleState "archived"}}
|
||||
<span class="status-pill archived" style="font-size: 0.7rem; padding: 0.1rem 0.4rem;">Archived</span>
|
||||
{{end}}
|
||||
</div>
|
||||
<!-- QR code link quick view in printer sheet -->
|
||||
<a href="/admin/qr/{{.Slug}}" target="_blank" style="font-size: 0.75rem; color: var(--color-text-light); text-decoration: underline;">
|
||||
<a href="javascript:void(0)" onclick="openQRModal('{{.Slug}}', '{{.Slug}}')" style="font-size: 0.75rem; color: var(--color-text-light); text-decoration: underline; cursor: pointer;">
|
||||
View QR Code
|
||||
</a>
|
||||
</div>
|
||||
@@ -57,21 +71,56 @@
|
||||
<td style="text-align: center; font-weight: 600; font-size: 0.95rem; color: var(--color-text-muted);">
|
||||
{{.Clicks}}
|
||||
</td>
|
||||
<td style="text-align: right;">
|
||||
<td class="actions-cell" style="text-align: right;">
|
||||
{{if .ItemID.Valid}}
|
||||
<!-- Asset link modifications are handled through items CRUD -->
|
||||
<span style="color: var(--color-text-light); font-size: 0.85rem; font-style: italic;">Managed by Asset</span>
|
||||
{{else}}
|
||||
<div style="display: inline-flex; gap: 0.5rem;">
|
||||
<a href="/admin/shortener?edit={{.ID}}" class="btn btn-secondary" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Edit
|
||||
</a>
|
||||
<form action="/admin/shortener/delete/{{.ID}}" method="POST" onsubmit="return confirm('Are you sure you want to delete this custom redirect?')" style="margin: 0;">
|
||||
{{else if eq .LifecycleState "removed"}}
|
||||
<!-- Soft removed manual redirects -->
|
||||
<div style="display: inline-flex; gap: 0.5rem; align-items: center;">
|
||||
<form action="/admin/shortener/restore/{{.ID}}" method="POST" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="btn btn-danger" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Delete
|
||||
<button type="submit" class="btn btn-secondary" style="padding: 0.35rem 0.65rem; font-size: 0.8rem; border-color: #10b981; color: #10b981;">
|
||||
Restore
|
||||
</button>
|
||||
</form>
|
||||
<form action="/admin/shortener/permanent-delete/{{.ID}}" method="POST" onsubmit="return confirm('Are you sure you want to permanently delete this redirect? This action cannot be undone.')" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="btn btn-danger" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Delete Forever
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{{else}}
|
||||
<!-- Active / Archived manual redirects -->
|
||||
<div style="display: inline-flex; gap: 0.5rem; align-items: center;">
|
||||
{{if ne .LifecycleState "archived"}}
|
||||
<a href="/admin/shortener?edit={{.ID}}&show_removed={{if $.ShowRemoved}}1{{else}}0{{end}}" class="btn btn-secondary" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Edit
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
<div class="actions-dropdown">
|
||||
<button class="btn btn-danger" onclick="toggleActionsDropdown(this, event)" style="padding: 0.35rem 0.65rem; font-size: 0.8rem; display: inline-flex; align-items: center; gap: 0.25rem;">
|
||||
Delete <span style="font-size: 0.65rem;">▼</span>
|
||||
</button>
|
||||
<div class="actions-dropdown-menu">
|
||||
<form action="/admin/shortener/remove/{{.ID}}" method="POST" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="actions-dropdown-item text-danger">
|
||||
🗑 Remove
|
||||
</button>
|
||||
</form>
|
||||
{{if ne .LifecycleState "archived"}}
|
||||
<form action="/admin/shortener/archive/{{.ID}}" method="POST" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="actions-dropdown-item text-warning">
|
||||
📦 Archive
|
||||
</button>
|
||||
</form>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</td>
|
||||
@@ -138,6 +187,20 @@
|
||||
</form>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<!-- Slug Length Settings -->
|
||||
<div class="card" style="margin-top: 1rem;">
|
||||
<h3 style="font-weight: 700; margin-bottom: 0.5rem; font-size: 1rem;">URL Slug Length</h3>
|
||||
<p style="font-size: 0.8rem; color: var(--color-text-light); margin-bottom: 1rem;">Controls the character length of auto-generated short URL slugs. Shorter slugs make smaller QR codes. Changes apply to newly created assets only.</p>
|
||||
<form action="/admin/shortener/slug-length" method="POST">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<div style="display: flex; gap: 0.5rem; align-items: center;">
|
||||
<input type="number" name="slug_length" class="form-control" value="{{.SlugLength}}" min="3" max="16" style="width: 80px; text-align: center; font-weight: 700; font-size: 1.1rem;">
|
||||
<span style="font-size: 0.85rem; color: var(--color-text-muted);">characters</span>
|
||||
<button type="submit" class="btn btn-primary" style="margin-left: auto; padding: 0.5rem 1rem; font-size: 0.85rem;">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
@@ -7,6 +7,15 @@
|
||||
<p>Label and categorize assets to easily group similar items together (e.g. Tools, Electronics, Fragile)</p>
|
||||
</div>
|
||||
</div>
|
||||
<form action="/admin/tags" method="GET" class="filter-bar" style="margin-bottom: 1.5rem; justify-content: flex-end;">
|
||||
{{if .EditingTag}}
|
||||
<input type="hidden" name="edit" value="{{.EditingTag.ID}}">
|
||||
{{end}}
|
||||
<label style="display: flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; font-weight: 500; cursor: pointer; white-space: nowrap;">
|
||||
<input type="checkbox" name="show_removed" value="1" {{if .ShowRemoved}}checked{{end}} onchange="this.form.submit()">
|
||||
Show removed tags
|
||||
</label>
|
||||
</form>
|
||||
|
||||
<div class="detail-grid">
|
||||
<!-- Left Column: Tags List -->
|
||||
@@ -25,11 +34,14 @@
|
||||
<tbody>
|
||||
{{if .Tags}}
|
||||
{{range .Tags}}
|
||||
<tr>
|
||||
<tr class="{{if eq .LifecycleState "removed"}}lifecycle-removed{{else if eq .LifecycleState "archived"}}lifecycle-archived{{end}}">
|
||||
<td>
|
||||
<span class="tag-pill" style="background-color: {{.Color}}; color: #1c1917; padding: 0.35rem 0.75rem; font-size: 0.85rem;">
|
||||
{{.Name}}
|
||||
</span>
|
||||
{{if eq .LifecycleState "archived"}}
|
||||
<span class="status-pill archived" style="margin-left: 0.5rem; font-size: 0.7rem; padding: 0.1rem 0.4rem;">Archived</span>
|
||||
{{end}}
|
||||
</td>
|
||||
<td>
|
||||
<code style="font-family: monospace; font-size: 0.9rem; background-color: var(--color-bg-base); padding: 0.15rem 0.35rem; border-radius: 4px; border: 1px solid var(--color-border);">
|
||||
@@ -37,20 +49,53 @@
|
||||
</code>
|
||||
</td>
|
||||
<td style="color: var(--color-text-muted); font-size: 0.9rem;">{{.Description}}</td>
|
||||
<td style="text-align: right;">
|
||||
<div style="display: inline-flex; gap: 0.5rem;">
|
||||
<a href="/admin/tags?edit={{.ID}}" class="btn btn-secondary" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Edit
|
||||
</a>
|
||||
{{if ne .Name "Default Room"}}
|
||||
<form action="/admin/tags/delete/{{.ID}}" method="POST" onsubmit="return confirm('Are you sure you want to delete this tag? All associated items will lose this tag reference.')" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="btn btn-danger" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Delete
|
||||
</button>
|
||||
</form>
|
||||
{{else}}
|
||||
<td class="actions-cell" style="text-align: right;">
|
||||
<div style="display: inline-flex; gap: 0.5rem; align-items: center;">
|
||||
{{if eq .Name "Default Room"}}
|
||||
<span style="color: var(--color-text-light); font-size: 0.8rem; font-style: italic; padding: 0.35rem 0.65rem;">Locked</span>
|
||||
{{else if eq .LifecycleState "removed"}}
|
||||
<!-- Soft removed actions -->
|
||||
<form action="/admin/tags/restore/{{.ID}}" method="POST" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="btn btn-secondary" style="padding: 0.35rem 0.65rem; font-size: 0.8rem; border-color: #10b981; color: #10b981;">
|
||||
Restore
|
||||
</button>
|
||||
</form>
|
||||
<form action="/admin/tags/permanent-delete/{{.ID}}" method="POST" onsubmit="return confirm('Are you sure you want to permanently delete this tag? All associated items will lose this tag reference.')" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="btn btn-danger" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Delete Forever
|
||||
</button>
|
||||
</form>
|
||||
{{else}}
|
||||
<!-- Active / Archived actions -->
|
||||
{{if ne .LifecycleState "archived"}}
|
||||
<a href="/admin/tags?edit={{.ID}}&show_removed={{if $.ShowRemoved}}1{{else}}0{{end}}" class="btn btn-secondary" style="padding: 0.35rem 0.65rem; font-size: 0.8rem;">
|
||||
Edit
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
<div class="actions-dropdown">
|
||||
<button class="btn btn-danger" onclick="toggleActionsDropdown(this, event)" style="padding: 0.35rem 0.65rem; font-size: 0.8rem; display: inline-flex; align-items: center; gap: 0.25rem;">
|
||||
Delete <span style="font-size: 0.65rem;">▼</span>
|
||||
</button>
|
||||
<div class="actions-dropdown-menu">
|
||||
<form action="/admin/tags/remove/{{.ID}}" method="POST" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="actions-dropdown-item text-danger">
|
||||
🗑 Remove
|
||||
</button>
|
||||
</form>
|
||||
{{if ne .LifecycleState "archived"}}
|
||||
<form action="/admin/tags/archive/{{.ID}}" method="POST" style="margin: 0;">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="actions-dropdown-item text-warning">
|
||||
📦 Archive
|
||||
</button>
|
||||
</form>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
Reference in new issue
Block a user