summaryrefslogtreecommitdiff
path: root/web-ui/app
diff options
context:
space:
mode:
authorPedro Vereza <pdrvereza@gmail.com>2014-10-19 22:03:50 -0200
committerPedro Vereza <pdrvereza@gmail.com>2014-10-19 22:03:50 -0200
commit13dceb0929d5b615742df3d99f868fe49c304c4b (patch)
treebd6d0f1be5bc77186e0358351170c6dc66243330 /web-ui/app
parent3aab6bd8c1ac45c2c5637bf86663f31cd4ea531c (diff)
#115 - Checked mails depend on current tag
Diffstat (limited to 'web-ui/app')
-rw-r--r--web-ui/app/js/mail_list/ui/mail_list.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/web-ui/app/js/mail_list/ui/mail_list.js b/web-ui/app/js/mail_list/ui/mail_list.js
index 7b518320..e873d279 100644
--- a/web-ui/app/js/mail_list/ui/mail_list.js
+++ b/web-ui/app/js/mail_list/ui/mail_list.js
@@ -75,7 +75,10 @@ define(
if (data.ident) {
self.attr.currentMailIdent = data.ident;
}
+
self.attr.currentTag = data.tag || self.attr.currentTag;
+
+ self.updateCheckAllCheckbox();
}
function renderMails(mails) {
@@ -132,17 +135,25 @@ define(
};
this.respondWithCheckedMails = function (ev, caller) {
- this.trigger(caller, events.ui.mail.hereChecked, { checkedMails : this.attr.checkedMails });
+ this.trigger(caller, events.ui.mail.hereChecked, { checkedMails : this.checkedMailsForCurrentTag()});
};
this.updateCheckAllCheckbox = function () {
- if (_.keys(this.attr.checkedMails).length > 0) {
+ if (this.checkedMailsForCurrentTag().length > 0) {
this.trigger(document, events.ui.mails.hasMailsChecked, true);
} else {
this.trigger(document, events.ui.mails.hasMailsChecked, false);
}
};
+ this.checkedMailsForCurrentTag = function() {
+ var checkedMailsForCurrentTag = _.filter(self.attr.checkedMails, function(mail) {
+ return _.contains(mail.tags, self.attr.currentTag);
+ });
+
+ return checkedMailsForCurrentTag.length > 0 ? checkedMailsForCurrentTag : {};
+ }
+
this.addToSelectedMails = function (ev, data) {
this.attr.checkedMails[data.mail.ident] = data.mail;
this.updateCheckAllCheckbox();