-
-
Notifications
You must be signed in to change notification settings - Fork 148
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 3874-v4-api-documentation
- Loading branch information
Showing
178 changed files
with
8,672 additions
and
2,869 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
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
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
document.addEventListener('htmx:beforeRequest', function () { | ||
// If the mobile error message is currently visible, adds the 'hidden' class | ||
// to hide it. | ||
let mobileErrorMessage = document.getElementById('mobile-export-csv-error'); | ||
if (!mobileErrorMessage.classList.contains('hidden')) { | ||
mobileErrorMessage.classList.add('hidden'); | ||
} | ||
|
||
// If the desktop error message is currently visible, adds the 'hidden' class | ||
// to hide it. | ||
let desktopErrorMessage = document.getElementById('export-csv-error'); | ||
if (!desktopErrorMessage.classList.contains('hidden')) { | ||
desktopErrorMessage.classList.add('hidden'); | ||
} | ||
}); | ||
|
||
document.addEventListener('htmx:beforeOnLoad', function (event) { | ||
// Get the XMLHttpRequest object from the event details | ||
const xhr = event.detail.xhr; | ||
if (xhr.status == 200) { | ||
const response = xhr.response; | ||
// Extract the filename from the Content-Disposition header and get | ||
//the MIME type from the Content-Type header | ||
const filename = xhr.getResponseHeader('Content-Disposition').split('=')[1]; | ||
const mimetype = xhr.getResponseHeader('Content-Type'); | ||
|
||
// Prepare a link element for a file download | ||
// Create a hidden link element for download | ||
const link = document.createElement('a'); | ||
link.style.display = 'none'; | ||
|
||
// Create a Blob object containing the response data with the correct | ||
// MIME type and generate a temporary URL for it | ||
const blob = new Blob([response], { type: mimetype }); | ||
const url = window.URL.createObjectURL(blob); | ||
|
||
// Set the link's attributes for download | ||
link.href = url; | ||
link.download = filename.replaceAll('"', ''); | ||
|
||
// It needs to be added to the DOM so it can be clicked | ||
document.body.appendChild(link); | ||
link.click(); | ||
|
||
// Release the temporary URL after download (for memory management) | ||
window.URL.revokeObjectURL(url); | ||
} else { | ||
// If the request failed, show the error messages | ||
let mobileErrorMessage = document.getElementById('mobile-export-csv-error'); | ||
mobileErrorMessage.classList.remove('hidden'); | ||
|
||
let desktopErrorMessage = document.getElementById('export-csv-error'); | ||
desktopErrorMessage.classList.remove('hidden'); | ||
} | ||
}); |
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,32 @@ | ||
let trickleInterval = null; | ||
|
||
function updateProgressBar() { | ||
let progressElement = document.getElementById('progress-bar'); | ||
let oldValue = 0; | ||
if ('value' in progressElement.dataset) { | ||
oldValue = parseFloat(progressElement.dataset.value); | ||
} | ||
let newValue = oldValue + Math.random() / 10; | ||
if (newValue >= 1) newValue = 1; | ||
progressElement.style.width = `${10 + newValue * 75}%`; | ||
progressElement.dataset.value = newValue; | ||
} | ||
|
||
function installProgressBar() { | ||
let progressElement = document.createElement('div'); | ||
progressElement.id = 'progress-bar'; | ||
progressElement.classList.add('turbo-progress-bar'); | ||
progressElement.style.width = '0'; | ||
progressElement.style.opacity = '1'; | ||
document.body.prepend(progressElement); | ||
trickleInterval = window.setInterval(updateProgressBar, 300); | ||
} | ||
|
||
function disableAllSubmitButtons() { | ||
// Get all submit buttons on the page | ||
const submitButtons = document.querySelectorAll('input[type="submit"],button[type="submit"]'); | ||
// Disable each element | ||
submitButtons.forEach((button) => { | ||
button.disabled = true; | ||
}); | ||
} |
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
Oops, something went wrong.