diff options
author | Alexandre Pretto Nunes <anunes@thoughtworks.com> | 2014-12-17 19:19:25 -0200 |
---|---|---|
committer | Alexandre Pretto Nunes <anunes@thoughtworks.com> | 2015-01-06 16:27:26 -0200 |
commit | 7ab9f9423004adf1df9cc1be1b2a5ae7eade4a95 (patch) | |
tree | bb8aeadbc6f9ce4798ce1eaabc40d66972ba1f5b /web-ui/app/js/mail_list/ui | |
parent | 0ff59644d8e804bcab928d184b31a5e6cdc2f6ed (diff) |
Separate auto-refresh for mails and tags, and start moving away from having the left_pane_dispatcher as a middleman
Diffstat (limited to 'web-ui/app/js/mail_list/ui')
-rw-r--r-- | web-ui/app/js/mail_list/ui/mail_items/mail_item.js | 2 | ||||
-rw-r--r-- | web-ui/app/js/mail_list/ui/mail_list.js | 17 |
2 files changed, 5 insertions, 14 deletions
diff --git a/web-ui/app/js/mail_list/ui/mail_items/mail_item.js b/web-ui/app/js/mail_list/ui/mail_items/mail_item.js index 24c7b043..ed1fd07f 100644 --- a/web-ui/app/js/mail_list/ui/mail_items/mail_item.js +++ b/web-ui/app/js/mail_list/ui/mail_items/mail_item.js @@ -32,6 +32,7 @@ define( this.doSelect = function () { this.$node.addClass('selected'); + this.checkCheckbox(); }; this.doUnselect = function () { @@ -72,6 +73,7 @@ define( this.attachListeners = function () { this.on(this.$node.find('input[type=checkbox]'), 'change', this.triggerMailChecked); this.on(document, events.ui.mails.cleanSelected, this.doUnselect); + this.on(document, events.ui.tag.select, this.doUnselect); this.on(document, events.ui.mails.uncheckAll, this.uncheckCheckbox); this.on(document, events.ui.mails.checkAll, this.checkCheckbox); }; 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 56c5c4f9..11300346 100644 --- a/web-ui/app/js/mail_list/ui/mail_list.js +++ b/web-ui/app/js/mail_list/ui/mail_list.js @@ -121,23 +121,11 @@ define( }; this.respondWithCheckedMails = function (ev, caller) { - this.trigger(caller, events.ui.mail.hereChecked, { checkedMails: this.checkedMailsForCurrentTag()}); + this.trigger(caller, events.ui.mail.hereChecked, {checkedMails: self.attr.checkedMails}); }; this.updateCheckAllCheckbox = function () { - 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 self.attr.currentTag === 'all' || mail.mailbox === self.attr.currentTag || _.contains(mail.tags, self.attr.currentTag); - }); - - return checkedMailsForCurrentTag.length > 0 ? checkedMailsForCurrentTag : {}; + this.trigger(document, events.ui.mails.hasMailsChecked, {hasMailsChecked: this.attr.checkedMails.length > 0}); }; this.addToSelectedMails = function (ev, data) { @@ -177,6 +165,7 @@ define( self = this; this.on(document, events.ui.mails.cleanSelected, this.cleanSelected); + this.on(document, events.ui.tag.select, this.cleanSelected); this.on(document, events.mails.available, this.showMails); this.on(document, events.mails.availableForRefresh, this.refreshMailList); |