summaryrefslogtreecommitdiff
path: root/web-ui/app
diff options
context:
space:
mode:
Diffstat (limited to 'web-ui/app')
-rw-r--r--web-ui/app/js/dispatchers/middle_pane_dispatcher.js2
-rw-r--r--web-ui/app/js/mail_list_actions/ui/archive_many_trigger.js29
-rw-r--r--web-ui/app/js/mail_list_actions/ui/mail_list_actions.js3
-rw-r--r--web-ui/app/js/mail_view/ui/no_mails_available_pane.js6
-rw-r--r--web-ui/app/js/page/events.js2
-rw-r--r--web-ui/app/js/services/mail_service.js26
-rw-r--r--web-ui/app/locales/en-us/translation.json2
-rw-r--r--web-ui/app/locales/pt/translation.json2
-rw-r--r--web-ui/app/locales/sv/translation.json2
-rw-r--r--web-ui/app/templates/compose/no_mails_available.hbs6
-rw-r--r--web-ui/app/templates/mail_actions/actions_box.hbs1
11 files changed, 73 insertions, 8 deletions
diff --git a/web-ui/app/js/dispatchers/middle_pane_dispatcher.js b/web-ui/app/js/dispatchers/middle_pane_dispatcher.js
index 7a53b769..12222aec 100644
--- a/web-ui/app/js/dispatchers/middle_pane_dispatcher.js
+++ b/web-ui/app/js/dispatchers/middle_pane_dispatcher.js
@@ -57,7 +57,7 @@ define(['flight/lib/component', 'page/events', 'helpers/triggering', 'mail_view/
NoMailsAvailablePane.teardownAll();
} else {
var child_div = this.createChildDiv(this.attr.noMailsAvailablePane);
- NoMailsAvailablePane.attachTo(child_div, {tag: data.tag});
+ NoMailsAvailablePane.attachTo(child_div, {tag: data.tag, forSearch: data.forSearch});
}
};
diff --git a/web-ui/app/js/mail_list_actions/ui/archive_many_trigger.js b/web-ui/app/js/mail_list_actions/ui/archive_many_trigger.js
new file mode 100644
index 00000000..b148cdce
--- /dev/null
+++ b/web-ui/app/js/mail_list_actions/ui/archive_many_trigger.js
@@ -0,0 +1,29 @@
+define(
+ [
+ 'flight/lib/component',
+ 'views/templates',
+ 'mixins/with_enable_disable_on_event',
+ 'page/events'
+ ],
+
+ function(definecomponent, templates, withEnableDisableOnEvent, events) {
+ 'use strict';
+
+ return definecomponent(archiveManyTrigger, withEnableDisableOnEvent(events.ui.mails.hasMailsChecked));
+ function archiveManyTrigger() {
+
+ this.getMailsToArchive = function() {
+ this.trigger(document, events.ui.mail.wantChecked, this.$node);
+ };
+
+ this.archiveManyEmails = function(event, data) {
+ this.trigger(document, events.mail.archiveMany, data);
+ };
+
+ this.after('initialize', function () {
+ this.on('click', this.getMailsToArchive);
+ this.on(events.ui.mail.hereChecked, this.archiveManyEmails);
+ });
+ }
+ }
+);
diff --git a/web-ui/app/js/mail_list_actions/ui/mail_list_actions.js b/web-ui/app/js/mail_list_actions/ui/mail_list_actions.js
index 2c9c699f..f71ed07c 100644
--- a/web-ui/app/js/mail_list_actions/ui/mail_list_actions.js
+++ b/web-ui/app/js/mail_list_actions/ui/mail_list_actions.js
@@ -29,6 +29,7 @@ define(
'mail_list_actions/ui/pagination_trigger',
'mail_list_actions/ui/delete_many_trigger',
'mail_list_actions/ui/recover_many_trigger',
+ 'mail_list_actions/ui/archive_many_trigger',
'mail_list_actions/ui/mark_many_as_read_trigger',
'mail_list_actions/ui/mark_as_unread_trigger'
],
@@ -45,6 +46,7 @@ define(
paginationTrigger,
deleteManyTrigger,
recoverManyTrigger,
+ archiveManyTrigger,
markManyAsReadTrigger,
markAsUnreadTrigger
) {
@@ -60,6 +62,7 @@ define(
paginationTrigger.attachTo('#pagination-trigger');
deleteManyTrigger.attachTo('#delete-selected');
recoverManyTrigger.attachTo('#recover-selected');
+ archiveManyTrigger.attachTo('#archive-selected');
markManyAsReadTrigger.attachTo('#mark-selected-as-read');
markAsUnreadTrigger.attachTo('#mark-selected-as-unread');
refresher.attachTo(document);
diff --git a/web-ui/app/js/mail_view/ui/no_mails_available_pane.js b/web-ui/app/js/mail_view/ui/no_mails_available_pane.js
index 32b6bc19..b1d5f9dd 100644
--- a/web-ui/app/js/mail_view/ui/no_mails_available_pane.js
+++ b/web-ui/app/js/mail_view/ui/no_mails_available_pane.js
@@ -30,11 +30,15 @@ define(
function noMailsAvailablePane() {
this.defaultAttrs({
- tag: null
+ tag: null,
+ forSearch: ''
});
+ var mailsQueryMatch = /-?in:"[\w]+"|tag:"[\w]+"/g;
+
this.render = function() {
this.attr.tag = this.attr.tag.toUpperCase();
+ this.attr.forSearch = this.attr.forSearch.replace(mailsQueryMatch, '').trim().toUpperCase();
this.$node.html(templates.noMailsAvailable(this.attr));
};
diff --git a/web-ui/app/js/page/events.js b/web-ui/app/js/page/events.js
index f82a6b36..307fc8d1 100644
--- a/web-ui/app/js/page/events.js
+++ b/web-ui/app/js/page/events.js
@@ -56,6 +56,7 @@ define(function () {
delete: 'ui:mail:delete',
deleteMany: 'ui:mail:deleteMany',
recoverMany: 'ui:mail:recoverMany',
+ archiveMany: 'ui:mail:archiveMany',
wantChecked: 'ui:mail:wantChecked',
hereChecked: 'ui:mail:hereChecked',
checked: 'ui:mail:checked',
@@ -117,6 +118,7 @@ define(function () {
unread: 'mail:unread',
delete: 'mail:delete',
deleteMany: 'mail:deleteMany',
+ archiveMany: 'mail:archiveMany',
recoverMany: 'mail:recoverMany',
deleted: 'mail:deleted',
saveDraft: 'draft:save',
diff --git a/web-ui/app/js/services/mail_service.js b/web-ui/app/js/services/mail_service.js
index 04194964..a63d517e 100644
--- a/web-ui/app/js/services/mail_service.js
+++ b/web-ui/app/js/services/mail_service.js
@@ -128,11 +128,32 @@ define(
var mails = dataToRecover.mails || [dataToRecover.mail];
this.refreshMails();
- this.trigger(document, events.ui.userAlerts.displayMessage, { message: dataToRecover.successMessage});
+ this.trigger(document, events.ui.userAlerts.displayMessage, { message: i18n(dataToRecover.successMessage)});
this.trigger(document, events.ui.mails.uncheckAll);
}, this);
};
+ this.triggerArchived = function (dataToArchive) {
+ return _.bind(function (response) {
+ this.refreshMails();
+ this.trigger(document, events.ui.userAlerts.displayMessage, { message: i18n(response.successMessage)});
+ 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'})
@@ -222,7 +243,7 @@ define(
monitoredAjax(this, url, { dataType: 'json' })
.done(function (data) {
this.attr.numPages = Math.ceil(data.stats.total / this.attr.pageSize);
- this.trigger(document, events.mails.available, _.merge(_.merge({tag: this.attr.currentTag }), this.parseMails(data)));
+ this.trigger(document, events.mails.available, _.merge({tag: this.attr.currentTag, forSearch: this.attr.lastQuery }, this.parseMails(data)));
}.bind(this))
.fail(function () {
this.trigger(document, events.ui.userAlerts.displayMessage, { message: i18n('Could not fetch messages') });
@@ -299,6 +320,7 @@ define(
this.on(document, events.mail.delete, this.deleteMail);
this.on(document, events.mail.deleteMany, this.deleteManyMails);
this.on(document, events.mail.recoverMany, this.recoverManyMails);
+ this.on(document, events.mail.archiveMany, this.archiveManyMails);
this.on(document, events.search.perform, this.newSearch);
this.on(document, events.ui.tag.selected, this.fetchByTag);
this.on(document, events.ui.tag.select, this.fetchByTag);
diff --git a/web-ui/app/locales/en-us/translation.json b/web-ui/app/locales/en-us/translation.json
index 7c90926d..05a65c72 100644
--- a/web-ui/app/locales/en-us/translation.json
+++ b/web-ui/app/locales/en-us/translation.json
@@ -3,7 +3,7 @@
"re": "Re: ",
"Fwd: ": "Fwd: ",
"Your message was moved to trash!": "Your message was moved to trash!",
- "Your message was archive it!": "Your message was archived!",
+ "Your message was archived": "Your message was archived",
"Your message was permanently deleted!": "Your message was permanently deleted!",
"Saved as draft.": "Saved as draft.",
"One or more of the recipients are not valid emails": "One or more of the recipients are not valid emails",
diff --git a/web-ui/app/locales/pt/translation.json b/web-ui/app/locales/pt/translation.json
index 2885e12b..7f553d04 100644
--- a/web-ui/app/locales/pt/translation.json
+++ b/web-ui/app/locales/pt/translation.json
@@ -2,7 +2,7 @@
"compose": "Escrever",
"re": "Res: ",
"Your message was moved to trash!": "Sua mensagem foi movida para a lixeira!",
- "Your message was archive it!": "Sua mensagem foi arquivada!",
+ "Your message was archived": "Sua mensagem foi arquivada!",
"Your message was permanently deleted!": "Sua mensagem foi permanentemente deletada!",
"Saved as draft.": "Mensagem salva como rascunho.",
"One or more of the recipients are not valid emails": "Email de um ou mais destinatários é inválido",
diff --git a/web-ui/app/locales/sv/translation.json b/web-ui/app/locales/sv/translation.json
index f4848d7a..45c34a63 100644
--- a/web-ui/app/locales/sv/translation.json
+++ b/web-ui/app/locales/sv/translation.json
@@ -3,7 +3,7 @@
"re": "Sv: ",
"Fwd: ": "VB: ",
"Your message was moved to trash!": "Ditt meddelande har flyttats till papperskorgen!",
- "Your message was archive it!": "Ditt meddelande har arkiverats!",
+ "Your message was archived": "Ditt meddelande har arkiverats!",
"Your message was permanently deleted!": "Ditt meddelande har tagits bort permanent!",
"Saved as draft.": "Sparat som utkast.",
"One or more of the recipients are not valid emails": "En eller flera mottagare är inte giltiga epost-adresser",
diff --git a/web-ui/app/templates/compose/no_mails_available.hbs b/web-ui/app/templates/compose/no_mails_available.hbs
index ce887267..6388d7db 100644
--- a/web-ui/app/templates/compose/no_mails_available.hbs
+++ b/web-ui/app/templates/compose/no_mails_available.hbs
@@ -1,3 +1,7 @@
<div class="scene">
- <div class="text">{{t 'NO EMAILS IN'}} '{{ tag }}'.</div>
+ {{#if forSearch }}
+ <div class="text">{{t 'NO RESULTS FOR'}}: '{{ forSearch }}'.</div>
+ {{else}}
+ <div class="text">{{t 'NO EMAILS IN'}} '{{ tag }}'.</div>
+ {{/if}}
</div>
diff --git a/web-ui/app/templates/mail_actions/actions_box.hbs b/web-ui/app/templates/mail_actions/actions_box.hbs
index b6dc2f53..07dcc9e9 100644
--- a/web-ui/app/templates/mail_actions/actions_box.hbs
+++ b/web-ui/app/templates/mail_actions/actions_box.hbs
@@ -2,5 +2,6 @@
<li><input type="button" id="mark-selected-as-read" value="{{t 'Mark as read'}}" disabled="disabled"/></li>
<li><input type="button" id="mark-selected-as-unread" value="{{t 'Mark as unread'}}" disabled="disabled"/></li>
<li><input type="button" id="delete-selected" value="{{t 'Delete'}}" disabled="disabled"/></li>
+<li><input type="button" id="archive-selected" value="{{t 'Archive'}}" disabled="disabled"/></li>
<li id="pagination-trigger" class="right"></li>
<li id="refresh-trigger" class="right"></li>