diff options
author | Jefferson Stachelski <jstachel@thoughtworks.com> | 2015-10-21 17:50:48 -0200 |
---|---|---|
committer | Jefferson Stachelski <jstachel@thoughtworks.com> | 2015-10-21 17:50:48 -0200 |
commit | 1c149819bd57de8b85351cd4a631a181faac9eee (patch) | |
tree | 624c715e3ab83850cd965ed5171cb78d84b80c28 /web-ui/app/js/mail_view/ui/recipients/recipient.js | |
parent | 4d5f54625b13542237bd5a157fc3238828dd1e26 (diff) | |
parent | 949885a3ba8ba23a2e7a5785814be08d31708562 (diff) |
Merge branch 'master' of https://github.com/SamuelToh/pixelated-user-agent
Diffstat (limited to 'web-ui/app/js/mail_view/ui/recipients/recipient.js')
-rw-r--r-- | web-ui/app/js/mail_view/ui/recipients/recipient.js | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/web-ui/app/js/mail_view/ui/recipients/recipient.js b/web-ui/app/js/mail_view/ui/recipients/recipient.js index f8909fe1..f4e6e9a6 100644 --- a/web-ui/app/js/mail_view/ui/recipients/recipient.js +++ b/web-ui/app/js/mail_view/ui/recipients/recipient.js @@ -19,10 +19,11 @@ define( [ 'flight/lib/component', - 'views/templates' + 'views/templates', + 'page/events' ], - function (defineComponent, templates) { + function (defineComponent, templates, events) { return defineComponent(recipient); @@ -36,6 +37,24 @@ define( return component; }; + this.recipientDelActions = function () { + this.on(this.$node.find('.recipient-del'), 'click', function (event) { + this.doSelect(); + this.trigger(events.ui.recipients.deleteRecipient, {recipientsName : this.attr.address}); + event.preventDefault(); + }); + + this.on(this.$node.find('.recipient-del'), 'mouseover', function () { + this.$node.find('.recipient-value').addClass('deleting'); + this.$node.find('.recipient-del').addClass('deleteTooltip'); + }); + + this.on(this.$node.find('.recipient-del'), 'mouseout', function () { + this.$node.find('.recipient-value').removeClass('deleting'); + this.$node.find('.recipient-del').removeClass('deleteTooltip'); + }); + }; + this.destroy = function () { this.$node.remove(); this.teardown(); @@ -49,6 +68,10 @@ define( this.$node.find('.recipient-value').removeClass('selected'); }; + this.isSelected = function () { + return this.$node.find('.recipient-value').hasClass('selected'); + }; + this.discoverEncryption = function () { this.$node.addClass('discorver-encryption'); var p = $.getJSON('/keys?search=' + this.attr.address).promise(); @@ -58,11 +81,12 @@ define( }.bind(this)); p.fail(function () { this.$node.find('.recipient-value').addClass('not-encrypted'); - this.$node.removeClass('discorver-encryption'); + this.$node.removeClass('discorver-encryption'); }.bind(this)); }; this.after('initialize', function () { + this.recipientDelActions(); this.discoverEncryption(); }); } |