Fix action button sizing and add QR modal to admin dashboard
- Normalize Edit/QR/Del button sizes in role=group with consistent padding, font-size, and white-space:nowrap - Add QR button to each link row in My Links and Anonymous Links tables - QR modal uses <dialog> + qr.min.js to generate an inline SVG on click Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
1bfad9ed7c
commit
a75f5b35f2
2 files changed
+26
-2
No files matched your search
@@ -62,8 +62,13 @@ table td {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
[role="group"] form button {
|
||||
height: 100%;
|
||||
[role="group"] a[role="button"],
|
||||
[role="group"] form button,
|
||||
[role="group"] button {
|
||||
padding: 0.25rem 0.5rem;
|
||||
font-size: 0.85rem;
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
h1 a {
|
||||
|
||||
@@ -92,6 +92,7 @@
|
||||
<td>
|
||||
<div role="group">
|
||||
<a href="/admin/edit/{{.ID}}" role="button" class="outline">Edit</a>
|
||||
<button type="button" class="outline" onclick="showQR('/{{.Slug}}')">QR</button>
|
||||
<form method="post" action="/admin/delete/{{.ID}}" onsubmit="return confirm('Delete /{{.Slug}}?')">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="outline secondary">Del</button>
|
||||
@@ -143,6 +144,7 @@
|
||||
<td>
|
||||
<div role="group">
|
||||
<a href="/admin/edit/{{.ID}}" role="button" class="outline">Edit</a>
|
||||
<button type="button" class="outline" onclick="showQR('/{{.Slug}}')">QR</button>
|
||||
<form method="post" action="/admin/delete/{{.ID}}" onsubmit="return confirm('Delete /{{.Slug}}?')">
|
||||
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
|
||||
<button type="submit" class="outline secondary">Del</button>
|
||||
@@ -166,10 +168,27 @@
|
||||
</article>
|
||||
|
||||
</main>
|
||||
<dialog id="qr-dialog">
|
||||
<article>
|
||||
<header>
|
||||
<button aria-label="Close" rel="prev" onclick="document.getElementById('qr-dialog').close()"></button>
|
||||
<h3>QR Code</h3>
|
||||
</header>
|
||||
<div id="qr-container" style="text-align:center"></div>
|
||||
</article>
|
||||
</dialog>
|
||||
<script src="/static/qr.min.js"></script>
|
||||
<script>
|
||||
document.querySelectorAll('.tile-dest').forEach(el => {
|
||||
try { el.textContent = new URL(el.textContent.trim()).hostname; } catch(e) {}
|
||||
});
|
||||
function showQR(slug) {
|
||||
var url = location.origin + slug;
|
||||
var container = document.getElementById('qr-container');
|
||||
container.innerHTML = QR.toSVG(url.toUpperCase(), {size: 200}) +
|
||||
'<p style="margin-top:0.5rem;word-break:break-all">' + url + '</p>';
|
||||
document.getElementById('qr-dialog').showModal();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user