aboutsummaryrefslogtreecommitdiff
path: root/static/js/dropdown.js
diff options
context:
space:
mode:
authorBobby <[email protected]>2026-03-08 08:11:41 +0530
committerBobby <[email protected]>2026-03-08 08:11:41 +0530
commitb2a231280ce3265d20cdc5f317ae1bcc5eb59924 (patch)
tree90eb1a5f5409025db47097e2e083361f8fa52555 /static/js/dropdown.js
parent662dd2069dc8590e8b54823a33726464cf10c4e7 (diff)
downloaddove-b2a231280ce3265d20cdc5f317ae1bcc5eb59924.tar.xz
dove-b2a231280ce3265d20cdc5f317ae1bcc5eb59924.zip
Add webmail email management templates and storage utilities
- Implemented email listing template with read/unread and star functionality. - Created empty state template for webmail when no emails are present. - Developed folder navigation template for managing email folders. - Added email preview template for displaying selected email details. - Introduced storage utilities for managing email files, including creation, reading, moving, and deletion. - Defined constants for storage paths and error messages related to file operations.
Diffstat (limited to 'static/js/dropdown.js')
-rw-r--r--static/js/dropdown.js26
1 files changed, 17 insertions, 9 deletions
diff --git a/static/js/dropdown.js b/static/js/dropdown.js
index 0bfcc88..5b1fb25 100644
--- a/static/js/dropdown.js
+++ b/static/js/dropdown.js
@@ -13,23 +13,29 @@ function initDropdowns() {
trigger.addEventListener("click", function () {
dropdown.classList.toggle("open");
- if (dropdown.classList.contains("open")) {
+ if (dropdown.classList.contains("open") && search) {
search.value = "";
filterOptions("");
search.focus();
}
});
- search.addEventListener("input", function () {
- filterOptions(search.value.toLowerCase());
- });
+ if (search) {
+ search.addEventListener("input", function () {
+ filterOptions(search.value.toLowerCase());
+ });
+ }
options.forEach(function (option) {
option.addEventListener("click", function () {
- hiddenInput.value = option.dataset.value;
- label.textContent = option.dataset.label;
- label.classList.remove("text-zinc-500");
- label.classList.add("text-zinc-200");
+ if (hiddenInput) {
+ hiddenInput.value = option.dataset.value;
+ }
+ if (label) {
+ label.textContent = option.dataset.label;
+ label.classList.remove("text-zinc-500");
+ label.classList.add("text-zinc-200");
+ }
options.forEach(function (other) {
other.classList.remove("selected");
@@ -47,7 +53,9 @@ function initDropdowns() {
option.style.display = matches ? "" : "none";
if (matches) visibleCount++;
});
- empty.classList.toggle("hidden", visibleCount > 0);
+ if (empty) {
+ empty.classList.toggle("hidden", visibleCount > 0);
+ }
}
document.addEventListener("click", function (event) {