diff options
author | Alexandre Pretto Nunes <anunes@thoughtworks.com> | 2015-01-24 13:28:32 -0200 |
---|---|---|
committer | Pixpoa pairing <pixpoapairing@pixelated-project.org> | 2015-01-29 14:55:22 -0200 |
commit | 1af7c273015246c0cf4130278b2c17fca9de563a (patch) | |
tree | 5b86c94945d398d4846612b9a0d197b9ac157d95 /web-ui/app/js/mail_list/ui | |
parent | 494960adc6ed4444e1b7d2ce027567ceefb2f972 (diff) |
Small refactor on mail items
Diffstat (limited to 'web-ui/app/js/mail_list/ui')
4 files changed, 7 insertions, 15 deletions
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 }); |