diff options
author | Jefferson Stachelski <jstachel@thoughtworks.com> | 2015-11-13 12:06:36 -0200 |
---|---|---|
committer | Jefferson Stachelski <jstachel@thoughtworks.com> | 2015-11-13 16:01:27 -0200 |
commit | 6f3e6e546457cacc35916bb7867edb1c5cfb9ab6 (patch) | |
tree | 450b2cfd5ac49fb2bf729b820bb861a0aff6dcc3 /web-ui/app/js/services | |
parent | c9caf2f49ae09c7ce76022b63ed9047b37d71ffb (diff) |
Issue #523 - Added some JS test
Diffstat (limited to 'web-ui/app/js/services')
-rw-r--r-- | web-ui/app/js/services/mail_service.js | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/web-ui/app/js/services/mail_service.js b/web-ui/app/js/services/mail_service.js index 6a42d920..a63d517e 100644 --- a/web-ui/app/js/services/mail_service.js +++ b/web-ui/app/js/services/mail_service.js @@ -137,11 +137,23 @@ define( return _.bind(function (response) { this.refreshMails(); this.trigger(document, events.ui.userAlerts.displayMessage, { message: i18n(response.successMessage)}); - //this.trigger(document, events.ui.userAlerts.displayMessage, { message: i18n("Your message was archived")}); this.trigger(document, events.ui.mails.uncheckAll); }, this); }; + this.archiveManyMails = function(event, dataToArchive) { + var mailIdents = _.map(dataToArchive.checkedMails, function (mail) { + return mail.ident; + }); + monitoredAjax(this, '/mails/archive', { + type: 'POST', + dataType: 'json', + contentType: 'application/json; charset=utf-8', + data: JSON.stringify({idents: mailIdents}) + }).done(this.triggerArchived(dataToArchive)) + .fail(this.errorMessage(i18n('Could not archive emails'))); + }; + this.deleteMail = function (ev, data) { monitoredAjax(this, '/mail/' + data.mail.ident, {type: 'DELETE'}) @@ -179,20 +191,6 @@ define( .fail(this.errorMessage(i18n('Could not move emails to inbox'))); }; - this.archiveManyMails = function(event, dataToArchive) { - var mailIdents = _.map(dataToArchive.checkedMails, function (mail) { - return mail.ident; - }); - - monitoredAjax(this, '/mails/archive', { - type: 'POST', - dataType: 'json', - contentType: 'application/json; charset=utf-8', - data: JSON.stringify({idents: mailIdents}) - }).done(this.triggerArchived(dataToArchive)) - .fail(this.errorMessage(i18n('Could not archive emails'))); - } - function compileQuery(data) { var query = 'tag:"' + that.attr.currentTag + '"'; |