-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some page handlers issues (#1288)
* The browser title updates, message controls work, & unecessary unread requests are stopped * Fix message parts view and the download of attachements * FIX: generated site.js includes js_modules with a one-level deep folder * Fix profiles page test * fix tests
- Loading branch information
Showing
15 changed files
with
88 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function showLoaderToast(text = 'Loading...') { | ||
const uniqueId = Math.random().toString(36).substring(7); | ||
const toastHTML = ` | ||
<div class="position-fixed bottom-0 start-0 p-3" style="z-index: 11"> | ||
<div class="toast bg-primary text-white" id="${uniqueId}" role="alert" aria-live="assertive" aria-atomic="true" data-bs-autohide="false"> | ||
<div class="toast-body"> | ||
<div class="d-flex align-items-center"> | ||
<strong>${text}</strong> | ||
<div class="spinner-border ms-auto" role="status" aria-hidden="true"></div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
` | ||
|
||
document.body.insertAdjacentHTML('beforeend', toastHTML) | ||
|
||
const instance = bootstrap.Toast.getOrCreateInstance(document.getElementById(uniqueId)); | ||
instance.show(); | ||
|
||
return instance; | ||
} |
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,21 @@ | ||
function handleAttachementDownload() { | ||
$('.download_link a').on("click", async function(e) { | ||
e.preventDefault(); | ||
const loaderInstance = showLoaderToast("Downloading attachment..."); | ||
const href = $(this).data('src'); | ||
try { | ||
await fetch(href).then(res => res.blob()).then(blob => { | ||
const url = URL.createObjectURL(blob); | ||
const a = document.createElement('a'); | ||
a.href = url; | ||
a.download = 'attachment'; | ||
a.click(); | ||
URL.revokeObjectURL(url); | ||
}); | ||
} catch (error) { | ||
Hm_Notices.show([`ERR${error.message}`]); | ||
} finally { | ||
loaderInstance.hide(); | ||
} | ||
}); | ||
} |
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,7 @@ | ||
function handleViewMessagePart() { | ||
$('.msg_part_link').on("click", function(e) { | ||
e.preventDefault(); | ||
const messagePart = $(this).data('messagePart'); | ||
get_message_content(messagePart, getMessageUidParam() ?? inline_msg_uid, getListPathParam()); | ||
}); | ||
} |
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