aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSawyer Bergeron <sbergeron@iol.unh.edu>2019-07-08 16:57:26 +0000
committerGerrit Code Review <gerrit@opnfv.org>2019-07-08 16:57:26 +0000
commit3bc9170d34ee6cd10bb02fa7641cccd2037562bb (patch)
tree40faa8f32b9b12c28ffde08bdf4a24ca4d635800
parentc84a22a2f0cc6dcfbd5a26821baf7e5addcfe73d (diff)
parentfb6de4fb3de1ec7a6f869ee04bdd7f2d156b8f44 (diff)
Merge "Add 'no messages available' to empty inbox"
-rw-r--r--src/templates/notifier/inbox.html20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/templates/notifier/inbox.html b/src/templates/notifier/inbox.html
index 9d7b426..26b6d32 100644
--- a/src/templates/notifier/inbox.html
+++ b/src/templates/notifier/inbox.html
@@ -18,6 +18,7 @@
<div class="row flex-grow-1" id="fixHeight">
<!-- Notification list && Controls -->
<div class="mb-2 mb-lg-0 col-lg-2 px-0 mh-100">
+ <span class="text-muted d-none" id="noMessages">No messages available</span>
<div class="list-group rounded-0 rounded-left overflow-auto mh-100 notifications" id="unreadNotifications" data-read="0">
{% for notification in unread_notifications %}
<a
@@ -56,18 +57,31 @@
$(obj).addClass("active");
}
+ // Shows messages in the given notification list.
+ // Shows/hides the 'no messages' span after checking children amount
+ // given the .notification classed element
+ function showMessages(notificationList) {
+ $(".notifications").addClass("d-none");
+ if (notificationList.children().length < 1) {
+ $("#noMessages").removeClass("d-none");
+ } else {
+ $("#noMessages").addClass("d-none");
+ notificationList.removeClass("d-none");
+ }
+ }
+
$(document).ready(function(){
// For all / unread / read
$("#filterGroup button").click(function(){
let read = $(this).attr("data-read");
$(this).siblings().removeClass("active");
- $(".notifications").addClass("d-none");
$(this).addClass("active");
if (read === "-1") {
- return $(".notifications").removeClass("d-none");
+ return showMessages($(".notifications"));
}
- $(`.notifications[data-read="${read}"]`).removeClass("d-none");
+ return showMessages($(`.notifications[data-read="${read}"]`));
});
+ showMessages($(".notifications"));
});
</script>
{% endblock %} \ No newline at end of file