-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into code-cleanup-db
- Loading branch information
Showing
21 changed files
with
256 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import '@fortawesome/fontawesome-free/js/fontawesome' | ||
import '@fortawesome/fontawesome-free/js/solid' | ||
import '@fortawesome/fontawesome-free/js/regular' | ||
import '@fortawesome/fontawesome-free/js/brands' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import 'htmx.org'; | ||
import 'hyperscript.org'; | ||
|
||
window.htmx = require('htmx.org'); | ||
window._hyperscript = require('hyperscript.org'); | ||
window._hyperscript.browserInit(); | ||
|
||
function htmx_resend(event) { | ||
let eventType; | ||
if (event.detail.requestConfig.triggeringEvent) { | ||
eventType = event.detail.requestConfig.triggeringEvent.type | ||
} else { | ||
eventType = "retry" | ||
} | ||
|
||
let timeout; | ||
|
||
if (event.detail.error.includes("429")) { | ||
timeout = 4000; | ||
} else { | ||
timeout = 2000; | ||
} | ||
|
||
setTimeout(function () { | ||
console.log("Sending HTMX retry event") | ||
htmx.trigger(event.detail.elt, eventType); | ||
}, timeout); | ||
} | ||
|
||
// https://htmx.org/docs/#config | ||
htmx.config.globalViewTransitions = true | ||
htmx.config.useTemplateFragments = true // for swapping of table items | ||
|
||
|
||
window.addEventListener("DOMContentLoaded", (event) => { | ||
document.body.addEventListener("htmx:sendError", htmx_resend); | ||
document.body.addEventListener("htmx:responseError", htmx_resend); | ||
document.body.addEventListener("htmx:loadError", htmx_resend); | ||
document.body.addEventListener("htmx:afterRequest", () => { | ||
const drawer = document.getElementById("service_list_drawer"); | ||
|
||
if (drawer) { | ||
drawer.checked = false; | ||
} | ||
}); | ||
document.body.addEventListener('htmx:configRequest', (event) => { | ||
event.detail.headers['X-CSRFToken'] = '{{ csrf_token }}'; | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Downloads a file from the specified URL. | ||
* | ||
* @param {string} downloadUrl - The URL of the file to be downloaded. | ||
*/ | ||
|
||
/*#__NO_RENAME__*/ | ||
window.download_file = function Download_file(downloadUrl) { | ||
var xhr = new XMLHttpRequest(); | ||
xhr.open('GET', downloadUrl, true); | ||
xhr.onload = function () { | ||
if (this.status === 200) { | ||
var response = JSON.parse(this.responseText); | ||
|
||
// Use the download_link and filename from the JSON response | ||
var downloadLink = response.download_link; | ||
var filename = response.filename; | ||
|
||
// Trigger the download using a link element | ||
var a = document.createElement('a'); | ||
a.href = downloadLink; | ||
a.download = filename; | ||
document.body.appendChild(a); | ||
a.click(); | ||
document.body.removeChild(a); | ||
} | ||
}; | ||
xhr.send(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
{% load static %} | ||
{% load render_bundle from webpack_loader %} | ||
{% load tz_detect %} | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
|
@@ -29,7 +31,7 @@ | |
<!-- AlpineJS --> | ||
<script defer | ||
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script> | ||
{# <script src="{% static 'js/init-alpine.js' %}"></script>#} | ||
{# <script src="{% static 'js/c/init-alpine.js' %}"></script>#} | ||
<!-- SimpleMDE --> | ||
{# <script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>#} | ||
{# | ||
|
@@ -46,18 +48,17 @@ | |
<script src="https://unpkg.com/htmx.org/dist/ext/response-targets.js"></script> | ||
<script src="https://unpkg.com/[email protected]"></script> | ||
{% else %} | ||
<script src="{% static "js/bundle.js" %}"></script> | ||
{# <script defer type="text/javascript" src="{% static "js/c/init.js" %}"></script>#} | ||
{# <script defer type="text/javascript" src="{% static "js/c/htmx.js" %}"></script>#} | ||
{# <script defer type="text/javascript" src="{% static "js/c/font_awesome.js" %}"></script>#} | ||
{# {% render_bundle 'all' 'js' %}#} | ||
{% render_bundle 'init' 'js' %} | ||
{% render_bundle 'htmx' 'js' %} | ||
{% render_bundle 'font_awesome' 'js' %} | ||
<!-- Tailwind & DaisyUI --> | ||
<link rel="stylesheet" href="{% static 'src/output.css' %}"> | ||
{% endif %} | ||
<script src="{% static 'js/receipt_download.js' %}"></script> | ||
<script> | ||
// https://htmx.org/docs/#config | ||
htmx.config.globalViewTransitions = true | ||
htmx.config.useTemplateFragments = true // for swapping of table items | ||
Alpine.start() | ||
</script> | ||
{% render_bundle 'receipt_downloads' 'js' %} | ||
{{ analytics|safe }} | ||
{% load tz_detect %} | ||
{% tz_detect %} | ||
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!/bin/sh | ||
|
||
python3 manage.py test --parallel | ||
python3 manage.py collectstatic --no-input | ||
python3 manage.py test --parallel |
Oops, something went wrong.