summaryrefslogtreecommitdiff
path: root/web-ui
diff options
context:
space:
mode:
authorBruno Wagner <bwgpro@gmail.com>2015-04-09 12:50:17 -0300
committerBruno Wagner <bwgpro@gmail.com>2015-04-09 12:50:17 -0300
commit1e66153834b8d172195af80866694a84cc03aeea (patch)
treec26d54f5ebe05c2f267c801c4645ae53f8412ed2 /web-ui
parentbd78f1ff44061b17b80fef270c814a6e353179ad (diff)
parentd3c86f867d29b79eec1d280389975c920a7ec196 (diff)
Merge pull request #370 from bltavares/preprend-messages-with-response-information
Prepend mail quoting with the sender information #66 Removes argument fixing of the i18n library #66
Diffstat (limited to 'web-ui')
-rw-r--r--web-ui/app/js/helpers/view_helper.js13
-rw-r--r--web-ui/app/js/mixins/with_mail_edit_base.js4
-rw-r--r--web-ui/app/js/views/i18n.js8
-rw-r--r--web-ui/test/spec/helpers/view_helper.spec.js8
4 files changed, 20 insertions, 13 deletions
diff --git a/web-ui/app/js/helpers/view_helper.js b/web-ui/app/js/helpers/view_helper.js
index 6755b891..a682ae5e 100644
--- a/web-ui/app/js/helpers/view_helper.js
+++ b/web-ui/app/js/helpers/view_helper.js
@@ -22,7 +22,7 @@ define(
'quoted-printable/quoted-printable',
'utf8/utf8'
],
- function(contentType, htmlWhitelister, i18n_lib, quotedPrintable, utf8) {
+ function(contentType, htmlWhitelister, i18n, quotedPrintable, utf8) {
'use strict';
function formatStatusClasses(ss) {
@@ -109,12 +109,15 @@ define(
}, 1);
}
- function quoteMail(mail) {
- return '\n\n' + mail.textPlainBody.replace(/^/mg, '> ');
+ function prependFrom(mail) {
+ return i18n(
+ 'On __date__, <__from__> wrote:\n',
+ {'date': new Date(mail.header.date).toString(), 'from': mail.header.from}
+ );
}
- function i18n(text) {
- return i18n_lib.get(text);
+ function quoteMail(mail) {
+ return '\n\n' + prependFrom(mail) + mail.textPlainBody.replace(/^/mg, '> ');
}
return {
diff --git a/web-ui/app/js/mixins/with_mail_edit_base.js b/web-ui/app/js/mixins/with_mail_edit_base.js
index 9942e747..5efb8967 100644
--- a/web-ui/app/js/mixins/with_mail_edit_base.js
+++ b/web-ui/app/js/mixins/with_mail_edit_base.js
@@ -134,7 +134,7 @@ define(
} else {
this.trigger(
events.ui.userAlerts.displayMessage,
- {message: i18n.get('One or more of the recipients are not valid emails')}
+ {message: i18n('One or more of the recipients are not valid emails')}
);
this.trigger(events.mail.send_failed);
}
@@ -176,7 +176,7 @@ define(
this.draftSaved = function(event, data) {
this.attr.ident = data.ident;
if(!this.attr.silent) {
- this.trigger(document, events.ui.userAlerts.displayMessage, { message: i18n.get('Saved as draft.') });
+ this.trigger(document, events.ui.userAlerts.displayMessage, { message: i18n('Saved as draft.') });
}
delete this.attr.silent;
};
diff --git a/web-ui/app/js/views/i18n.js b/web-ui/app/js/views/i18n.js
index b09490f5..568e7635 100644
--- a/web-ui/app/js/views/i18n.js
+++ b/web-ui/app/js/views/i18n.js
@@ -17,15 +17,11 @@
define(['i18next'], function(i18n) {
'use strict';
- var self = function(str) {
- return i18n.t(str);
- };
-
- self.get = self;
+ var self = i18n.t;
self.init = function(path) {
i18n.init({detectLngQS: 'lang', fallbackLng: 'en', lowerCaseLng: true, getAsync: false, resGetPath: path + 'locales/__lng__/__ns__.json'});
- Handlebars.registerHelper('t', self.get.bind(self));
+ Handlebars.registerHelper('t', self.bind(self));
};
return self;
diff --git a/web-ui/test/spec/helpers/view_helper.spec.js b/web-ui/test/spec/helpers/view_helper.spec.js
index 7b5b960b..888c6cda 100644
--- a/web-ui/test/spec/helpers/view_helper.spec.js
+++ b/web-ui/test/spec/helpers/view_helper.spec.js
@@ -15,6 +15,14 @@ define(['helpers/view_helper'], function (viewHelper) {
expect(quotedMail).toContain('> First Line\n> Second Line');
});
+
+ it('should add the mail sender information', function() {
+ testData.rawMail.mail.textPlainBody = 'First Line\nSecond Line';
+
+ var quotedMail = viewHelper.quoteMail(testData.rawMail.mail);
+
+ expect(quotedMail).toContain('On Wed Jun 04 2014 17:41:13 GMT+0000 (UTC), <laurel@hamill.info> wrote');
+ });
});
describe('getFormmattedDate', function() {