diff options
Diffstat (limited to 'web-ui')
34 files changed, 208 insertions, 224 deletions
diff --git a/web-ui/app/index.html b/web-ui/app/index.html index d6e03de0..cbdae267 100644 --- a/web-ui/app/index.html +++ b/web-ui/app/index.html @@ -20,7 +20,7 @@ <div class="off-canvas-wrap move-right menu" data-offcanvas> <div class="inner-wrap"> <section id="left-pane" class="left-off-canvas-menu"> - <a class="left-off-canvas-logo" href="#"> + <a class="left-off-canvas-logo side-nav-toggle" href="#"> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="30.4 316.8 555.2 155.2" enable-background="new 30.4 316.8 555.2 155.2" xml:space="preserve"> <g> @@ -77,14 +77,13 @@ </section> <section id="middle-pane" class="small-9 medium-12 large-12 columns no-padding"> - <div id="mail-syncing-progress-bar" ></div> <ul id="mail-list"> </ul> </section> </article> <section id="right-pane" class="small-7 medium-7 large-7 columns"> - </section> + </section> </div> </div> diff --git a/web-ui/app/js/helpers/view_helper.js b/web-ui/app/js/helpers/view_helper.js index a682ae5e..8d841cc7 100644 --- a/web-ui/app/js/helpers/view_helper.js +++ b/web-ui/app/js/helpers/view_helper.js @@ -83,15 +83,6 @@ define( return res; } - function getFormattedDate(date){ - var today = createTodayDate(); - if (date.getTime() > today.getTime()) { - return fixedSizeNumber(date.getHours(), 2) + ':' + fixedSizeNumber(date.getMinutes(), 2); - } else { - return '' + date.getFullYear() + '-' + fixedSizeNumber(date.getMonth() + 1, 2) + '-' + fixedSizeNumber(date.getDate(), 2); - } - } - function createTodayDate() { var today = new Date(); today.setHours(0); @@ -120,11 +111,23 @@ define( return '\n\n' + prependFrom(mail) + mail.textPlainBody.replace(/^/mg, '> '); } + function formatDate(dateString) { + var date = new Date(dateString); + var today = createTodayDate(); + if (date.getTime() > today.getTime()) { + return fixedSizeNumber(date.getHours(), 2) + ':' + fixedSizeNumber(date.getMinutes(), 2); + } else { + return '' + date.getFullYear() + '-' + fixedSizeNumber(date.getMonth() + 1, 2) + '-' + fixedSizeNumber(date.getDate(), 2); + } + } + + Handlebars.registerHelper('formatDate', formatDate); + Handlebars.registerHelper('formatStatusClasses', formatStatusClasses); + return { formatStatusClasses: formatStatusClasses, formatMailBody: formatMailBody, moveCaretToEndOfText: moveCaretToEndOfText, - getFormattedDate: getFormattedDate, quoteMail: quoteMail, i18n: i18n }; diff --git a/web-ui/app/js/mail_list/ui/mail_item_factory.js b/web-ui/app/js/mail_list/ui/mail_item_factory.js index 3c815401..ddfa4c62 100644 --- a/web-ui/app/js/mail_list/ui/mail_item_factory.js +++ b/web-ui/app/js/mail_list/ui/mail_item_factory.js @@ -40,6 +40,7 @@ define( var mailItemContainer = $('<li>', { id: 'mail-' + mail.ident}); nodeToAttachTo.append(mailItemContainer); + mail.currentTag = currentTag; var mailToCreate = MAIL_ITEM_TYPE[mail.mailbox] || GenericMailItem; mailToCreate.attachTo(mailItemContainer, { mail: mail, diff --git a/web-ui/app/js/mail_list/ui/mail_items/draft_item.js b/web-ui/app/js/mail_list/ui/mail_items/draft_item.js index fda6c3f8..57fbafd5 100644 --- a/web-ui/app/js/mail_list/ui/mail_items/draft_item.js +++ b/web-ui/app/js/mail_list/ui/mail_items/draft_item.js @@ -33,16 +33,14 @@ define( if (this.isOpeningOnANewTab(ev)) { return; } - this.trigger(document, events.dispatchers.rightPane.openDraft, { ident: this.attr.ident }); - this.trigger(document, events.ui.mail.updateSelected, { ident: this.attr.ident }); - this.trigger(document, events.router.pushState, { mailIdent: this.attr.ident }); + this.trigger(document, events.dispatchers.rightPane.openDraft, { ident: this.attr.mail.ident }); + this.trigger(document, events.ui.mail.updateSelected, { ident: this.attr.mail.ident }); + this.trigger(document, events.router.pushState, { mailIdent: this.attr.mail.ident }); ev.preventDefault(); // don't let the hashchange trigger a popstate }; this.after('initialize', function () { - this.initializeAttributes(); this.render(); - this.attachListeners(); if (this.attr.isChecked) { this.checkCheckbox(); diff --git a/web-ui/app/js/mail_list/ui/mail_items/generic_mail_item.js b/web-ui/app/js/mail_list/ui/mail_items/generic_mail_item.js index b700eeeb..939f7e1b 100644 --- a/web-ui/app/js/mail_list/ui/mail_items/generic_mail_item.js +++ b/web-ui/app/js/mail_list/ui/mail_items/generic_mail_item.js @@ -38,14 +38,14 @@ define( updateMailStatusToRead.call(this); return; } - this.trigger(document, events.ui.mail.open, { ident: this.attr.ident }); - this.trigger(document, events.router.pushState, { mailIdent: this.attr.ident }); + this.trigger(document, events.ui.mail.open, { ident: this.attr.mail.ident }); + this.trigger(document, events.router.pushState, { mailIdent: this.attr.mail.ident }); ev.preventDefault(); // don't let the hashchange trigger a popstate }; function updateMailStatusToRead() { if (!_.contains(this.attr.mail.status, this.status.READ)) { - var mail_read_data = { ident: this.attr.ident, tags: this.attr.tags, mailbox: this.attr.mailbox }; + var mail_read_data = { ident: this.attr.mail.ident, tags: this.attr.mail.tags, mailbox: this.attr.mail.mailbox }; this.trigger(document, events.mail.read, mail_read_data); this.attr.mail.status.push(this.status.READ); this.$node.addClass(viewHelpers.formatStatusClasses(this.attr.mail.status)); @@ -53,16 +53,16 @@ define( } this.openMail = function (ev, data) { - if (data.ident !== this.attr.ident) { + if (data.ident !== this.attr.mail.ident) { return; } updateMailStatusToRead.call(this); - this.trigger(document, events.ui.mail.updateSelected, { ident: this.attr.ident }); + this.trigger(document, events.ui.mail.updateSelected, { ident: this.attr.mail.ident }); }; this.updateTags = function(ev, data) { - if(data.ident === this.attr.ident){ + if(data.ident === this.attr.mail.ident){ this.attr.tags = data.tags; if(!_.contains(this.attr.tags, this.attr.tag)) { this.teardown(); @@ -73,16 +73,13 @@ define( }; this.deleteMail = function(ev, data) { - if(data.mail.ident === this.attr.ident){ + if(data.mail.ident === this.attr.mail.ident){ this.teardown(); } }; this.after('initialize', function () { - this.initializeAttributes(); - this.attr.tagsForListView = _.without(this.attr.tags, this.attr.tag); this.render(); - this.attachListeners(); if (this.attr.isChecked) { this.checkCheckbox(); 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 bcd0444b..266db926 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 @@ -1,6 +1,6 @@ /* * Copyright (c) 2014 ThoughtWorks, Inc. - * + * * Pixelated is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or @@ -26,14 +26,10 @@ define( function mailItem() { this.updateSelected = function (ev, data) { - if(data.ident === this.attr.ident) { this.doSelect(); } + if (data.ident === this.attr.mail.ident) { this.doSelect(); } else { this.doUnselect(); } }; - this.formattedDate = function (date) { - return viewHelper.getFormattedDate(new Date(date)); - }; - this.isOpeningOnANewTab = function (ev) { return ev.metaKey || ev.ctrlKey || ev.which === 2; }; @@ -46,9 +42,12 @@ define( this.$node.removeClass('selected'); }; - this.triggerMailChecked = function (ev, data) { - var eventToTrigger = ev.target.checked ? events.ui.mail.checked : events.ui.mail.unchecked; - this.trigger(document, eventToTrigger, { mail: this.attr.mail}); + this.doMailChecked = function (ev) { + if (ev.target.checked) { + this.checkCheckbox(); + } else { + this.uncheckCheckbox(); + } }; this.checkboxElement = function () { @@ -57,42 +56,31 @@ define( this.checkCheckbox = function () { this.checkboxElement().prop('checked', true); - this.triggerMailChecked({'target': {'checked': true}}); + this.trigger(document, events.ui.mail.checked, { mail: this.attr.mail}); }; this.uncheckCheckbox = function () { this.checkboxElement().prop('checked', false); - this.triggerMailChecked({'target': {'checked': false}}); + this.trigger(document, events.ui.mail.unchecked, { mail: this.attr.mail}); }; this.render = function () { - this.attr.tagsForListView = _.without(this.attr.tags, this.attr.tag); - var mailItemHtml = templates.mails[this.attr.templateType](this.attr); + this.attr.mail.tagsForListView = _.without(this.attr.mail.tags, this.attr.tag); + var mailItemHtml = templates.mails[this.attr.templateType](this.attr.mail); this.$node.html(mailItemHtml); - this.$node.addClass(this.attr.statuses); - if(this.attr.selected) { this.doSelect(); } + this.$node.addClass(viewHelper.formatStatusClasses(this.attr.mail.status)); + if (this.attr.selected) { this.doSelect(); } this.on(this.$node.find('a'), 'click', this.triggerOpenMail); }; - this.initializeAttributes = function () { - var mail = this.attr.mail; - this.attr.ident = mail.ident; - this.attr.header = mail.header; - this.attr.ident = mail.ident; - this.attr.statuses = viewHelper.formatStatusClasses(mail.status); - this.attr.tags = mail.tags; - this.attr.attachments = mail.attachments; - this.attr.mailbox = mail.mailbox; - this.attr.header.formattedDate = this.formattedDate(mail.header.date); - }; - - this.attachListeners = function () { - this.on(this.$node.find('input[type=checkbox]'), 'change', this.triggerMailChecked); + this.after('initialize', function () { + this.on(this.$node.find('input[type=checkbox]'), 'change', this.doMailChecked); this.on(document, events.ui.mails.cleanSelected, this.doUnselect); this.on(document, events.ui.tag.select, this.doUnselect); + this.on(document, events.ui.tag.select, this.uncheckCheckbox); this.on(document, events.ui.mails.uncheckAll, this.uncheckCheckbox); this.on(document, events.ui.mails.checkAll, this.checkCheckbox); - }; + }); } return mailItem; diff --git a/web-ui/app/js/mail_list/ui/mail_items/sent_item.js b/web-ui/app/js/mail_list/ui/mail_items/sent_item.js index 3cfa25bd..9e511068 100644 --- a/web-ui/app/js/mail_list/ui/mail_items/sent_item.js +++ b/web-ui/app/js/mail_list/ui/mail_items/sent_item.js @@ -32,23 +32,20 @@ define( if (this.isOpeningOnANewTab(ev)) { return; } - this.trigger(document, events.ui.mail.open, { ident: this.attr.ident }); - this.trigger(document, events.router.pushState, { mailIdent: this.attr.ident }); + this.trigger(document, events.ui.mail.open, { ident: this.attr.mail.ident }); + this.trigger(document, events.router.pushState, { mailIdent: this.attr.mail.ident }); ev.preventDefault(); // don't let the hashchange trigger a popstate }; this.openMail = function (ev, data) { - if (data.ident !== this.attr.ident) { + if (data.ident !== this.attr.mail.ident) { return; } - this.trigger(document, events.ui.mail.updateSelected, { ident: this.attr.ident }); + this.trigger(document, events.ui.mail.updateSelected, { ident: this.attr.mail.ident }); }; this.after('initialize', function () { - this.initializeAttributes(); - this.attr.tagsForListView = _.without(this.attr.tags, this.attr.tag); this.render(); - this.attachListeners(); if (this.attr.isChecked) { this.checkCheckbox(); diff --git a/web-ui/app/js/mail_list/ui/mail_syncing_progress_bar.js b/web-ui/app/js/mail_list/ui/mail_syncing_progress_bar.js deleted file mode 100644 index 8d4eebb5..00000000 --- a/web-ui/app/js/mail_list/ui/mail_syncing_progress_bar.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2014 ThoughtWorks, Inc. - * - * Pixelated is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Pixelated is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Pixelated. If not, see <http://www.gnu.org/licenses/>. - */ - -define( - [ - 'flight/lib/component' - ], - - function (defineComponent) { - 'use strict'; - - return defineComponent(mailSyncingProgressbar); - - function mailSyncingProgressbar() { - this.updateProgressBar = function (count) { - this.attr.syncingMails = true; - - this.$node.css({ - 'width': (count.progress * 100).toFixed(2) + '%', - 'transition': '1000ms linear', - 'background-color': '#FF7902', - 'height': '3px' - }); - - }; - - this.resetProgressBar = function () { - this.$node.removeAttr('style'); - this.attr.syncingMails = false; - clearInterval(this.attr.updateIntervalId); - }; - - this.doUpdate = function () { - $.getJSON('/sync_info') - .success(function (data) { - if (data.is_syncing) { - this.updateProgressBar(data.count); - } else { - this.resetProgressBar(); - } - }.bind(this)) - .error(function () { - clearInterval(this.attr.poolIntervalId); - this.resetProgressBar(); - }.bind(this)); - }; - - this.checkForMailSyncing = function () { - if (this.attr.syncingMails) { - return; - } - this.attr.updateIntervalId = setInterval(this.doUpdate.bind(this), 1000); - }; - - this.after('initialize', function () { - this.checkForMailSyncing(); - this.attr.poolIntervalId = setInterval(this.checkForMailSyncing.bind(this), 20000); - }); - } - } -); diff --git a/web-ui/app/js/mail_view/ui/mail_view.js b/web-ui/app/js/mail_view/ui/mail_view.js index 578dcbb9..71a67e5a 100644 --- a/web-ui/app/js/mail_view/ui/mail_view.js +++ b/web-ui/app/js/mail_view/ui/mail_view.js @@ -47,9 +47,6 @@ define( this.displayMail = function (event, data) { this.attr.mail = data.mail; - var date = new Date(data.mail.header.date); - data.mail.header.formattedDate = viewHelpers.getFormattedDate(date); - var signed, encrypted; data.mail.security_casing = data.mail.security_casing || {}; 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 5efb8967..848fe026 100644 --- a/web-ui/app/js/mixins/with_mail_edit_base.js +++ b/web-ui/app/js/mixins/with_mail_edit_base.js @@ -74,7 +74,7 @@ define( if (!_.isUndefined(recipients) && !_.isEmpty(recipients)) { var recipientsUpdatedData = { newRecipients: recipients, - name: recipientsType + recipientsName: recipientsType }; this.trigger(document, events.ui.recipients.updated, recipientsUpdatedData); } diff --git a/web-ui/app/js/page/default.js b/web-ui/app/js/page/default.js index 16918d90..1571202e 100644 --- a/web-ui/app/js/page/default.js +++ b/web-ui/app/js/page/default.js @@ -20,7 +20,6 @@ define( 'mail_list_actions/ui/mail_list_actions', 'user_alerts/ui/user_alerts', 'mail_list/ui/mail_list', - 'mail_list/ui/mail_syncing_progress_bar', 'mail_view/ui/no_message_selected_pane', 'mail_view/ui/mail_view', 'mail_view/ui/mail_actions', @@ -51,7 +50,6 @@ define( mailListActions, userAlerts, mailList, - mailSyncingProgressBar, noMessageSelectedPane, mailView, mailViewActions, @@ -84,7 +82,6 @@ define( userAlerts.attachTo('#user-alerts'); mailList.attachTo('#mail-list'); - mailSyncingProgressBar.attachTo('#mail-syncing-progress-bar'); mailListActions.attachTo('#list-actions'); searchTrigger.attachTo('#search-trigger'); diff --git a/web-ui/app/js/tags/ui/tag_list.js b/web-ui/app/js/tags/ui/tag_list.js index d6f6f76c..a2172c6d 100644 --- a/web-ui/app/js/tags/ui/tag_list.js +++ b/web-ui/app/js/tags/ui/tag_list.js @@ -98,7 +98,6 @@ define( this.after('initialize', function() { this.on(document, events.tags.received, this.displayTags); this.on(document, events.ui.tag.select, this.updateCurrentTag); - this.on(document, events.ui.tag.select, events.ui.mails.uncheckAll); this.renderTagListTemplate(); }); } diff --git a/web-ui/app/locales/en-us/translation.json b/web-ui/app/locales/en-us/translation.json index b6fd6f0a..330e38b6 100644 --- a/web-ui/app/locales/en-us/translation.json +++ b/web-ui/app/locales/en-us/translation.json @@ -47,11 +47,11 @@ "encrypted encryption-valid": "Encrypted", "not-encrypted": "Not Encrypted", "signed": "Certified sender", - "signed signature-revoked": "Sender could not be securely identified.", - "signed signature-expired": "Sender could not be securely identified.", - "signed signature-not-trusted": "Sender and/or message cannot be trusted.", - "signed signature-unknown": "Sender and/or message cannot be trusted.", - "not-signed": "Sender could not be securely identified.", + "signed signature-revoked": "Sender could not be securely identifiedw", + "signed signature-expired": "Sender could not be securely identified", + "signed signature-not-trusted": "Sender and/or message cannot be trusted", + "signed signature-unknown": "Sender and/or message cannot be trusted", + "not-signed": "Uncertified sender", "send-button": "Send", "sending-mail": "Sending...", "draft-button": "Save Draft", diff --git a/web-ui/app/locales/en/translation.json b/web-ui/app/locales/en/translation.json index b6fd6f0a..a360cc02 100644 --- a/web-ui/app/locales/en/translation.json +++ b/web-ui/app/locales/en/translation.json @@ -47,11 +47,11 @@ "encrypted encryption-valid": "Encrypted", "not-encrypted": "Not Encrypted", "signed": "Certified sender", - "signed signature-revoked": "Sender could not be securely identified.", - "signed signature-expired": "Sender could not be securely identified.", - "signed signature-not-trusted": "Sender and/or message cannot be trusted.", - "signed signature-unknown": "Sender and/or message cannot be trusted.", - "not-signed": "Sender could not be securely identified.", + "signed signature-revoked": "Sender could not be securely identified", + "signed signature-expired": "Sender could not be securely identified", + "signed signature-not-trusted": "Sender and/or message cannot be trusted", + "signed signature-unknown": "Sender and/or message cannot be trusted", + "not-signed": "Uncertified sender", "send-button": "Send", "sending-mail": "Sending...", "draft-button": "Save Draft", diff --git a/web-ui/app/scss/_colors.scss b/web-ui/app/scss/_colors.scss index 4a1eba33..320a8d1a 100644 --- a/web-ui/app/scss/_colors.scss +++ b/web-ui/app/scss/_colors.scss @@ -34,5 +34,5 @@ $error: #D93C38; $attention: #F6A41C; $success: #50BA5B; -$will_be_encrypted: #41cd60; -$wont_be_encrypted: #F6A40A; +$will_be_encrypted: $success; +$wont_be_encrypted: $attention; diff --git a/web-ui/app/scss/_compose.scss b/web-ui/app/scss/_compose.scss index c026b866..acff745d 100644 --- a/web-ui/app/scss/_compose.scss +++ b/web-ui/app/scss/_compose.scss @@ -24,7 +24,8 @@ // COMPOSE PANE #compose-box, #draft-box, #reply-box { - margin: 0 0 50px 10px; + margin: 5px 0 50px 30px; + padding: 0; .input-container { border-bottom: 1px solid #DDD; padding: 1px; @@ -44,7 +45,6 @@ &#subject { font-size: 1.6875rem; line-height: 1.4; - margin-top: 26px; } } textarea { @@ -85,6 +85,10 @@ } } + button.close-mail-button { + margin: 1px; + } + @include recipients; } diff --git a/web-ui/app/scss/_mixins.scss b/web-ui/app/scss/_mixins.scss index 2ce4999a..e1f06425 100644 --- a/web-ui/app/scss/_mixins.scss +++ b/web-ui/app/scss/_mixins.scss @@ -133,7 +133,7 @@ input { display: inline; font-size: 1em; - padding: 2px 5px; + padding: 1px 5px; width: 120px; margin: 0; } @@ -202,11 +202,27 @@ &.selected { border: 1px solid #666666; } + + &:before { + font-family: FontAwesome; + padding-right: 4px; + + } &.encrypted { border-bottom-color: $will_be_encrypted; + + &:before { + color: $will_be_encrypted; + content: "\f023 "; + } } &.not-encrypted { border-bottom-color: $wont_be_encrypted; + + &:before { + color: $wont_be_encrypted; + content: "\f13e "; + } } background-color: #F5F5F5; border: 1px solid #D9D9D9; diff --git a/web-ui/app/scss/_read.scss b/web-ui/app/scss/_read.scss index 7235df72..d621f672 100644 --- a/web-ui/app/scss/_read.scss +++ b/web-ui/app/scss/_read.scss @@ -32,6 +32,13 @@ height: 27px; margin-right: 3px; } + + .full-view-header { + display:inline-block; + padding-top: 5px; + width:95%; + flex-shrink:1; + } } h3 { margin-bottom: 0; diff --git a/web-ui/app/scss/main.scss b/web-ui/app/scss/main.scss index f4ce2c4b..ed9b90c4 100644 --- a/web-ui/app/scss/main.scss +++ b/web-ui/app/scss/main.scss @@ -26,17 +26,6 @@ header#main { padding: 0; } -.tip-msg { - padding: 10px; - margin: 8px 20px -25px 20px; - background: $warning; - color: darken($warning, 50%); - font-size: 0.9em; - i { - margin-right: 5px; - } -} - .text-right { text-align: right; } diff --git a/web-ui/app/scss/styles.scss b/web-ui/app/scss/styles.scss index 6dd82c4e..4f2a56ee 100644 --- a/web-ui/app/scss/styles.scss +++ b/web-ui/app/scss/styles.scss @@ -344,7 +344,8 @@ section { visibility: hidden; opacity: 0; transition-duration: 500ms; - height: 220px; + height: 100%; + max-height: 220px; overflow: auto; background-color: lighten($navigation_background,1); diff --git a/web-ui/app/templates/compose/compose_box.hbs b/web-ui/app/templates/compose/compose_box.hbs index 300f8049..d5501e69 100644 --- a/web-ui/app/templates/compose/compose_box.hbs +++ b/web-ui/app/templates/compose/compose_box.hbs @@ -1,9 +1,6 @@ <button class="close-mail-button"> <i class="fa fa-times"></i> </button> -<div class="tip-msg"> - <i class="fa fa-lightbulb-o"></i>{{t "Don't worry about recipients right now, you'll be able to add them just before sending." }} -</div> <input type="text" id="subject" value="{{subject}}" placeholder="{{t 'Subject'}}" tabindex="1"/> <textarea id="text-box" placeholder="{{t 'Body'}}" tabindex="2">{{body}}</textarea> diff --git a/web-ui/app/templates/mails/draft.hbs b/web-ui/app/templates/mails/draft.hbs index 87862f34..c3d2fa5b 100644 --- a/web-ui/app/templates/mails/draft.hbs +++ b/web-ui/app/templates/mails/draft.hbs @@ -2,8 +2,8 @@ <input type="checkbox"/> </span> <span> - <a href="/#/{{ tag }}/mail/{{ ident }}"> - <span class="sent-date">{{ header.formattedDate }}</span> + <a href="/#/{{ currentTag }}/mail/{{ ident }}"> + <span class="sent-date">{{ formatDate header.date }}</span> <div class="from"> {{t 'to:'}} diff --git a/web-ui/app/templates/mails/full_view.hbs b/web-ui/app/templates/mails/full_view.hbs index 50ac2776..77994860 100644 --- a/web-ui/app/templates/mails/full_view.hbs +++ b/web-ui/app/templates/mails/full_view.hbs @@ -8,9 +8,9 @@ </button> - <div style="display:inline-block;padding-top: 5px;width:95%;flex-shrink:1" > + <div class="full-view-header"> - <div class="column large-10 no-padding security-status"> + <div class="column large-12 no-padding security-status"> {{#if signatureStatus}} <span class="{{signatureStatus}}"> {{t signatureStatus }} @@ -22,10 +22,7 @@ </span> {{/if}} </div> - <div class="column large-2 no-padding text-right"> - <span class="received-date">{{ header.formattedDate }}</span> - </div> - <div class="recipients column large-12 no-padding"> + <div class="recipients column large-10 no-padding"> <span class="from"> {{#if header.from }} {{ header.from }} @@ -36,7 +33,9 @@ <i class="fa fa-long-arrow-right"></i> {{{formatRecipients header}}} </div> - + <div class="recipients column large-2 text-right"> + <span class="received-date">{{ formatDate header.date }}</span> + </div> <div> <h3 class="subjectArea column large-10 no-padding"> <span class="subject">{{ header.subject }}</span> diff --git a/web-ui/app/templates/mails/sent.hbs b/web-ui/app/templates/mails/sent.hbs index e4b49b37..a0712124 100644 --- a/web-ui/app/templates/mails/sent.hbs +++ b/web-ui/app/templates/mails/sent.hbs @@ -2,8 +2,8 @@ <input type="checkbox"/> </span> <span> - <a href="/#/{{ tag }}/mail/{{ ident }}"> - <span class="sent-date">{{ header.formattedDate }}</span> + <a href="/#/{{ currentTag }}/mail/{{ ident }}"> + <span class="sent-date">{{ formatDate header.date }}</span> <div class="from"> {{t 'to:'}} diff --git a/web-ui/app/templates/mails/single.hbs b/web-ui/app/templates/mails/single.hbs index 90023713..47d600fb 100644 --- a/web-ui/app/templates/mails/single.hbs +++ b/web-ui/app/templates/mails/single.hbs @@ -2,8 +2,8 @@ <input type="checkbox" {{#if isChecked }}checked="true"{{/if}} /> </span> <span> - <a href="/#/{{ tag }}/mail/{{ ident }}"> - <span class="received-date">{{ header.formattedDate }} + <a href="/#/{{ currentTag }}/mail/{{ ident }}"> + <span class="received-date">{{ formatDate header.date }} {{#if attachments}} <div class="attachment-indicator"> <i class="fa fa-paperclip"></i> diff --git a/web-ui/app/templates/mails/trash.hbs b/web-ui/app/templates/mails/trash.hbs index a74c9606..4475aeb0 100644 --- a/web-ui/app/templates/mails/trash.hbs +++ b/web-ui/app/templates/mails/trash.hbs @@ -2,7 +2,7 @@ <input type="checkbox" {{#if isChecked }}checked="true"{{/if}} /> </span> <span> - <a href="/#/{{ tag }}/mail/{{ ident }}"> + <a href="/#/{{ currentTag }}/mail/{{ ident }}"> <span class="received-date">{{ header.formattedDate }} {{#if attachments}} <div class="attachment-indicator"> diff --git a/web-ui/test/spec/helpers/view_helper.spec.js b/web-ui/test/spec/helpers/view_helper.spec.js index 888c6cda..655ba181 100644 --- a/web-ui/test/spec/helpers/view_helper.spec.js +++ b/web-ui/test/spec/helpers/view_helper.spec.js @@ -9,41 +9,45 @@ define(['helpers/view_helper'], function (viewHelper) { describe('quote email', function() { it('should add > to body text', function() { - testData.rawMail.mail.textPlainBody = 'First Line\nSecond Line'; + testData.parsedMail.simpleTextPlain.textPlainBody = 'First Line\nSecond Line'; - var quotedMail = viewHelper.quoteMail(testData.rawMail.mail); + var quotedMail = viewHelper.quoteMail(testData.parsedMail.simpleTextPlain); expect(quotedMail).toContain('> First Line\n> Second Line'); }); it('should add the mail sender information', function() { - testData.rawMail.mail.textPlainBody = 'First Line\nSecond Line'; + testData.parsedMail.simpleTextPlain.textPlainBody = 'First Line\nSecond Line'; - var quotedMail = viewHelper.quoteMail(testData.rawMail.mail); + var quotedMail = viewHelper.quoteMail(testData.parsedMail.simpleTextPlain); - expect(quotedMail).toContain('On Wed Jun 04 2014 17:41:13 GMT+0000 (UTC), <laurel@hamill.info> wrote'); + expect(quotedMail).toContain('<laurel@hamill.info>'); }); }); - describe('getFormmattedDate', function() { + describe('formatDate', function() { + var template; + beforeEach(function () { + template = Handlebars.compile('{{formatDate date}}'); + }); + it('formats correctly a Date for today', function() { var d = new Date(); - var dtest = new Date(d.getFullYear(), d.getMonth(), d.getDate(), 14, 2, 36); - - var res = viewHelper.getFormattedDate(dtest); + var mailDate = new Date(d.getFullYear(), d.getMonth(), d.getDate(), 14, 2, 36); - expect(res).toEqual('14:02'); + var result = template({ date: mailDate.toISOString() }); + expect(result).toEqual('14:02'); }); it('formats correctly a Date for a specific day', function() { - var dtest = new Date(2013, 2, 13, 7, 56, 1); + var mailDate = new Date(2013, 2, 13, 7, 56, 1); - var res = viewHelper.getFormattedDate(dtest); + var result = template({ date: mailDate.toISOString() }); // This expectation is weird for the month - JS Dates have date numbers be zero-indexed, thus the discrepancy // Specifically, the 2 in the constructor DOES match the 3 in the expectation below. - expect(res).toEqual('2013-03-13'); + expect(result).toEqual('2013-03-13'); }); }); diff --git a/web-ui/test/spec/mail_list/ui/mail_items/draft_item.spec.js b/web-ui/test/spec/mail_list/ui/mail_items/draft_item.spec.js new file mode 100644 index 00000000..fbe285c6 --- /dev/null +++ b/web-ui/test/spec/mail_list/ui/mail_items/draft_item.spec.js @@ -0,0 +1,32 @@ +describeComponent('mail_list/ui/mail_items/draft_item', function () { + 'use strict'; + + var mail; + + beforeEach(function () { + mail = Pixelated.testData().parsedMail.draft; + + this.setupComponent('<li></li>', { + mail: mail, + selected: false, + templateType: 'single' + }); + }); + + it('should de-select the item if a new mail is composed', function () { + this.component.$node.addClass('selected'); + + $(document).trigger(Pixelated.events.ui.composeBox.newMessage); + + expect(this.component.$node).not.toHaveClass('selected'); + }); + + it('should trigger the openDraft event when clicked', function () { + var openDraftEvent = spyOnEvent(document, Pixelated.events.dispatchers.rightPane.openDraft); + + this.$node.find('a').click(); + + expect(openDraftEvent).toHaveBeenTriggeredOnAndWith(document, { ident: 'B2432' }); + }); +}); + diff --git a/web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js b/web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js index 88735302..87d38595 100644 --- a/web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js +++ b/web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js @@ -7,11 +7,11 @@ describeComponent('mail_list/ui/mail_items/generic_mail_item', function () { mail = Pixelated.testData().parsedMail.simpleTextPlain; mail.tags = []; mail.mailbox = 'inbox'; + mail.currentTag = 'inbox'; this.setupComponent('<li></li>', { mail: mail, selected: false, - tag: 'inbox', templateType: 'single' }); }); diff --git a/web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js b/web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js index 058040c9..03f95e54 100644 --- a/web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js +++ b/web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js @@ -20,6 +20,14 @@ describeMixin('mail_list/ui/mail_items/mail_item', function () { checkbox = this.component.$node.find('input[type=checkbox]'); }); + it('unchecks itself when another tag is selected', function () { + this.component.checkCheckbox(); + this.component.trigger(document, Pixelated.events.ui.tag.select, { tag: 'amazing'}); + + expect(mailUncheckedEvent).toHaveBeenTriggeredOn(document); + expect(checkbox.prop('checked')).toBe(false); + }); + it('checkCheckbox checks it and triggers events.ui.mail.checked', function () { this.component.checkCheckbox(); diff --git a/web-ui/test/spec/mail_view/ui/send_button.spec.js b/web-ui/test/spec/mail_view/ui/send_button.spec.js index 17de1531..351b4a08 100644 --- a/web-ui/test/spec/mail_view/ui/send_button.spec.js +++ b/web-ui/test/spec/mail_view/ui/send_button.spec.js @@ -25,6 +25,14 @@ describeComponent('mail_view/ui/send_button', function () { expect(this.$node).not.toBeDisabled(); }); + + it('gets enabled if recipients:updated also with invalid email', function () { + $(document).trigger(Pixelated.events.ui.recipients.inputFieldHasCharacters, { name: 'to' }); + $(document).trigger(Pixelated.events.ui.recipients.updated, { newRecipients: ['InvalidEmail']}); + + expect(this.$node).not.toBeDisabled(); + expect(this.$node.text()).toBe('Send'); + }); }); describe('multiple events', function () { @@ -63,14 +71,6 @@ describeComponent('mail_view/ui/send_button', function () { expect(this.$node).toBeDisabled(); }); - - it('gets disabled if recipients:updated with invalid email', function () { - $(document).trigger(Pixelated.events.ui.recipients.inputFieldHasCharacters, { name: 'to' }); - $(document).trigger(Pixelated.events.ui.recipients.updated, { newRecipients: ['InvalidEmail']}); - - expect(this.$node).not.toBeDisabled(); - expect(this.$node.text()).toBe('Send'); - }); }); describe('on click', function () { diff --git a/web-ui/test/spec/mixins/with_mail_edit_base.spec.js b/web-ui/test/spec/mixins/with_mail_edit_base.spec.js index 8f495399..940b4b5e 100644 --- a/web-ui/test/spec/mixins/with_mail_edit_base.spec.js +++ b/web-ui/test/spec/mixins/with_mail_edit_base.spec.js @@ -18,8 +18,8 @@ describeMixin('mixins/with_mail_edit_base', function () { recipients: { to: ['foobar@mail.com'], cc: [] } }); - expect(recipientsUpdatedEvent).toHaveBeenTriggeredOnAndWith(document, { newRecipients: ['foobar@mail.com'], name: 'to'}); - expect(recipientsUpdatedEvent).not.toHaveBeenTriggeredOnAndWith(document, { newRecipients: [], name: 'cc'}); + expect(recipientsUpdatedEvent).toHaveBeenTriggeredOnAndWith(document, { newRecipients: ['foobar@mail.com'], recipientsName: 'to'}); + expect(recipientsUpdatedEvent).not.toHaveBeenTriggeredOnAndWith(document, { newRecipients: [], recipientsName: 'cc'}); }); }); diff --git a/web-ui/test/spec/tags/ui/tag_list.spec.js b/web-ui/test/spec/tags/ui/tag_list.spec.js index e84c68aa..f92f72af 100644 --- a/web-ui/test/spec/tags/ui/tag_list.spec.js +++ b/web-ui/test/spec/tags/ui/tag_list.spec.js @@ -62,13 +62,6 @@ describeComponent('tags/ui/tag_list', function () { expect(this.component.attr.currentTag).toEqual('amazing'); }); - it('should uncheck all emails when a new tag is selected', function () { - var uncheckAllEvent = spyOnEvent(document, Pixelated.events.ui.mails.uncheckAll); - $(document).trigger(Pixelated.events.ui.tag.select, { tag: 'amazing'}); - - expect(uncheckAllEvent).toHaveBeenTriggeredOn(document); - }); - it('resets the tag lists when loading tags', function () { var tagList = [tag('tag1', 1, false), tag('tag2', 2, true), tag('tag3', 3, true)]; $(document).trigger(Pixelated.events.tags.received, {tags: tagList}); diff --git a/web-ui/test/test_data.js b/web-ui/test/test_data.js index f09260c9..446fd7c6 100644 --- a/web-ui/test/test_data.js +++ b/web-ui/test/test_data.js @@ -170,6 +170,38 @@ define(function() { } }; + var draftMail = { + status: [], + header: {'from': 'jed_waelchi@cummerata.info', + cc: [], + bcc: [], + to: [], + date: '2015-04-09T18:30:18.998999-03:00', + subject: 'bla'}, + ident: 'B2432', + replying: {'single': 'jed_waelchi@cummerata.info', + all: { + 'to-field': ['jed_waelchi@cummerata.info'], + 'cc-field': [] + } + }, + attachments: [], + textPlainBody: 'bla', + tags: [], + htmlBody: null, + mailbox: 'drafts', + security_casing: {'locks': [], + imprints: [{'state': 'no_signature_information'}] + }, + isSentMail: function() { return false; }, + isDraftMail: function() { return false; }, + replyToAddress: function() { return { to: ['jed_waelchi@cummerata.info'], cc: [] }; }, + replyToAllAddress: function() { return { to: ['jed_waelchi@cummerata.info'], cc: [] }; }, + isMailMultipartAlternative: function () { return false; }, + availableBodyPartsContentType: function () { return []; }, + getMailPartByContentType: function () { return; } + }; + var testData = { rawMail: { mail: rawMail, @@ -182,7 +214,8 @@ define(function() { }, parsedMail: { simpleTextPlain: simpleTextPlainMail, - html: htmlNoEncodingMail + html: htmlNoEncodingMail, + draft: draftMail } }; |