error modals are so on
This commit is contained in:
@@ -29,7 +29,7 @@ templ ErrorWithDetails(code int, err string, message string, details string) {
|
||||
<pre id="details" class="text-xs text-subtext0 font-mono whitespace-pre-wrap break-all bg-mantle p-4 rounded overflow-x-auto">{ details }</pre>
|
||||
</div>
|
||||
<button
|
||||
onclick="copyToClipboard('details')"
|
||||
onclick="copyToClipboard('details', 'copyButton')"
|
||||
id="copyButton"
|
||||
class="mt-2 bg-mauve text-crust px-3 py-1 rounded text-xs hover:bg-mauve/75 transition hover:cursor-pointer"
|
||||
title="Copy to clipboard"
|
||||
@@ -45,24 +45,7 @@ templ ErrorWithDetails(code int, err string, message string, details string) {
|
||||
</div>
|
||||
</div>
|
||||
if details != "" {
|
||||
<script>
|
||||
function copyToClipboard(id) {
|
||||
var details = document.getElementById(id).innerText;
|
||||
var button = document.getElementById("copyButton");
|
||||
navigator.clipboard
|
||||
.writeText(details)
|
||||
.then(function () {
|
||||
button.innerText = "Copied!";
|
||||
setTimeout(function () {
|
||||
button.innerText = "Copy";
|
||||
}, 2000);
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error("Failed to copy:", err);
|
||||
button.innerText = "Failed";
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script src="/static/js/copytoclipboard.js"></script>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user