aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/static/js
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2022-01-29 12:39:21 +0100
committerGravatar Leon Sandøy <[email protected]>2022-01-29 12:39:21 +0100
commit72ca8758da4b80b638a83093a35a031210a8d9f2 (patch)
tree9c0f585dda0ba2a6745bc63f681d28f34dbfebfb /pydis_site/static/js
parentMake all tags interactive. (diff)
Let the user know when there are no matches.
Diffstat (limited to 'pydis_site/static/js')
-rw-r--r--pydis_site/static/js/resources.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/pydis_site/static/js/resources.js b/pydis_site/static/js/resources.js
index c9ce408b..89b8ae06 100644
--- a/pydis_site/static/js/resources.js
+++ b/pydis_site/static/js/resources.js
@@ -112,6 +112,8 @@ function updateUI() {
}
// Otherwise, hide everything and then filter the resources to decide what to show.
+ let hasMatches = false;
+ console.log(hasMatches);
resources.hide();
resources.filter(function() {
let validation = {
@@ -140,11 +142,20 @@ function updateUI() {
// If validation passes, show the resource.
if (Object.values(validation).every(Boolean)) {
+ hasMatches = true;
return true;
} else {
return false;
}
}).show();
+
+ // If there are no matches, show the no matches message
+ console.log(hasMatches);
+ if (!hasMatches) {
+ $(".no-resources-found").show();
+ } else {
+ $(".no-resources-found").hide();
+ }
}
// Executed when the page has finished loading.