From 1af7c273015246c0cf4130278b2c17fca9de563a Mon Sep 17 00:00:00 2001 From: Alexandre Pretto Nunes Date: Sat, 24 Jan 2015 13:28:32 -0200 Subject: Small refactor on mail items --- web-ui/app/js/mail_list/ui/mail_items/draft_item.js | 6 +----- web-ui/app/js/mail_list/ui/mail_items/generic_mail_item.js | 6 +----- web-ui/app/js/mail_list/ui/mail_items/mail_item.js | 4 ++++ web-ui/app/js/mail_list/ui/mail_items/sent_item.js | 6 +----- 4 files changed, 7 insertions(+), 15 deletions(-) (limited to 'web-ui/app/js/mail_list/ui') 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 a2da917f..fda6c3f8 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 @@ -29,12 +29,8 @@ define( return defineComponent(draftItem, mailItem); function draftItem() { - function isOpeningOnANewTab(ev) { - return ev.metaKey || ev.ctrlKey || ev.which === 2; - } - this.triggerOpenMail = function (ev) { - if (isOpeningOnANewTab(ev)) { + if (this.isOpeningOnANewTab(ev)) { return; } this.trigger(document, events.dispatchers.rightPane.openDraft, { ident: this.attr.ident }); 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 3931ffd8..b700eeeb 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 @@ -33,12 +33,8 @@ define( READ: 'read' }; - function isOpeningOnANewTab(ev) { - return ev.metaKey || ev.ctrlKey || ev.which === 2; - } - this.triggerOpenMail = function (ev) { - if (isOpeningOnANewTab(ev)) { + if (this.isOpeningOnANewTab(ev)) { updateMailStatusToRead.call(this); return; } 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 f7ae2f0c..bcd0444b 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 @@ -34,6 +34,10 @@ define( return viewHelper.getFormattedDate(new Date(date)); }; + this.isOpeningOnANewTab = function (ev) { + return ev.metaKey || ev.ctrlKey || ev.which === 2; + }; + this.doSelect = function () { this.$node.addClass('selected'); }; 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 3e2e2723..3cfa25bd 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 @@ -28,12 +28,8 @@ define( return defineComponent(sentItem, mailItem); function sentItem() { - function isOpeningOnANewTab(ev) { - return ev.metaKey || ev.ctrlKey || ev.which === 2; - } - this.triggerOpenMail = function (ev) { - if (isOpeningOnANewTab(ev)) { + if (this.isOpeningOnANewTab(ev)) { return; } this.trigger(document, events.ui.mail.open, { ident: this.attr.ident }); -- cgit v1.2.3