mirror of
https://codeberg.org/catask-org/catask.git
synced 2025-04-20 05:43:41 -05:00
move some functions into admin/base.html
This commit is contained in:
parent
6d1ef386f5
commit
6304d8aeea
2 changed files with 14 additions and 17 deletions
|
@ -93,6 +93,20 @@
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ url_for('static', filename='js/toastify.min.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/toastify.min.js') }}"></script>
|
||||||
<script>
|
<script>
|
||||||
|
function showToast(message, type, gravity = "top", position = "right") {
|
||||||
|
Toastify({
|
||||||
|
text: message,
|
||||||
|
duration: 3000,
|
||||||
|
gravity: gravity,
|
||||||
|
position: position,
|
||||||
|
stopOnFocus: true,
|
||||||
|
className: `alert alert-${type} shadow alert-dismissible`,
|
||||||
|
close: true
|
||||||
|
}).showToast();
|
||||||
|
}
|
||||||
|
function saveConfig() {
|
||||||
|
document.getElementById('saveConfig').click();
|
||||||
|
};
|
||||||
document.addEventListener('htmx:afterRequest', function(event) {
|
document.addEventListener('htmx:afterRequest', function(event) {
|
||||||
const jsonResponse = event.detail.xhr.response;
|
const jsonResponse = event.detail.xhr.response;
|
||||||
if (jsonResponse && event.detail.target.dataset.dontshowtoast != '') {
|
if (jsonResponse && event.detail.target.dataset.dontshowtoast != '') {
|
||||||
|
|
|
@ -320,11 +320,6 @@
|
||||||
document.body.removeChild(a);
|
document.body.removeChild(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveConfig() {
|
|
||||||
document.getElementById('saveConfig').click();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
document.body.addEventListener("htmx:beforeRequest", function(evt) {
|
document.body.addEventListener("htmx:beforeRequest", function(evt) {
|
||||||
console.log("HTMX is making a request to:", evt.detail.pathInfo.finalRequestPath);
|
console.log("HTMX is making a request to:", evt.detail.pathInfo.finalRequestPath);
|
||||||
});
|
});
|
||||||
|
@ -333,18 +328,6 @@
|
||||||
console.log("HTMX swap completed on:", evt.detail.target);
|
console.log("HTMX swap completed on:", evt.detail.target);
|
||||||
});
|
});
|
||||||
|
|
||||||
function showToast(message, type, gravity = "top", position = "right") {
|
|
||||||
Toastify({
|
|
||||||
text: message,
|
|
||||||
duration: 3000,
|
|
||||||
gravity: gravity,
|
|
||||||
position: position,
|
|
||||||
stopOnFocus: true,
|
|
||||||
className: `alert alert-${type} shadow alert-dismissible`,
|
|
||||||
close: true
|
|
||||||
}).showToast();
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearCmText(toast = false) {
|
function clearCmText(toast = false) {
|
||||||
cmTextarea.value = "";
|
cmTextarea.value = "";
|
||||||
view.update([view.state.update({changes: {from: 0, to: view.state.doc.length, insert: ""}})]);
|
view.update([view.state.update({changes: {from: 0, to: view.state.doc.length, insert: ""}})]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue