Builds client SSR approach, sunsets old cljs.
This commit is contained in:
@@ -120,12 +120,54 @@ htmx.defineExtension('trigger-filter', {
|
||||
|
||||
|
||||
initDatepicker = function(elem) {
|
||||
elem.dp = new Datepicker(elem, {format: "mm/dd/yyyy", autohide: true});
|
||||
const modalParent = elem.closest('#modal-content');
|
||||
if (modalParent) {
|
||||
elem.dp = new Datepicker(elem, {format: "mm/dd/yyyy", autohide: true, container: ".modal-stack"});
|
||||
} else {
|
||||
elem.dp = new Datepicker(elem, {format: "mm/dd/yyyy", autohide: true});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
countRows = function(id) {
|
||||
var table = document.querySelector(id);
|
||||
var rows = table.querySelectorAll("tbody tr");
|
||||
console.log("ROWS", rows.length);
|
||||
return rows.length;
|
||||
}
|
||||
|
||||
htmx.onLoad(function(content) {
|
||||
var sortables = content.querySelectorAll(".sortable");
|
||||
for (var i = 0; i < sortables.length; i++) {
|
||||
var sortable = sortables[i];
|
||||
var sortableInstance = new Sortable(sortable, {
|
||||
animation: 150,
|
||||
ghostClass: 'bg-blue-100',
|
||||
|
||||
// Make the `.htmx-indicator` unsortable
|
||||
filter: ".htmx-indicator",
|
||||
onMove: function (evt) {
|
||||
return evt.related.className.indexOf('htmx-indicator') === -1;
|
||||
},
|
||||
|
||||
// Disable sorting on the `end` event
|
||||
onEnd: function (evt) {
|
||||
this.option("disabled", true);
|
||||
}
|
||||
});
|
||||
|
||||
// Re-enable sorting on the `htmx:afterSwap` event
|
||||
sortable.addEventListener("htmx:afterSwap", function() {
|
||||
sortableInstance.option("disabled", false);
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
async function copyToClipboard(text) {
|
||||
try {
|
||||
// Write the text to the clipboard
|
||||
await navigator.clipboard.writeText(text);
|
||||
console.log('Text copied to clipboard:', text);
|
||||
} catch (err) {
|
||||
console.error('Failed to copy text to clipboard:', err);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user