From 60e7f19ec5abca5463b4ea65819f99900730d98b Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 26 Oct 2012 16:17:43 +0200 Subject: [PATCH] [IMP] mail: bind event bzr revid: chm@openerp.com-20121026141743-m2kod12as9z2eale --- addons/mail/static/src/js/mail.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index f98e82481fa..5c41a38a91e 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -276,11 +276,11 @@ openerp.mail = function (session) { this.$el.on('change', 'input.oe_form_binary_file', self.on_attachment_change ); this.$el.on('click', '.oe_cancel', self.on_cancel ); - this.$el.on('click', '.oe_post', function () {self.on_message_post()} ); - this.$el.on('click', '.oe_full', function () {self.on_compose_fullmail('reply')} ); + this.$el.on('click', '.oe_post', _.bind( this.on_message_post, this) ); + this.$el.on('click', '.oe_full', _.bind( this.on_compose_fullmail, this, 'reply') ); /* stack for don't close the compose form if the user click on a button */ - this.$el.on('mousedown', 'div', function () { self.stay_open = true; }); + this.$el.on('mousedown', '.oe_msg_footer', function () { self.stay_open = true; }); this.$('textarea:not(.oe_compact):first').on('focus, mouseup, keydown', function () { self.stay_open = false; }); this.$('textarea:not(.oe_compact):first').autosize(); @@ -389,7 +389,7 @@ openerp.mail = function (session) { var message = thread.create_message_object( record[0] ); // insert the message on dom thread.insert_message( message, self.$el ); - if (thread.parent_thread) { + if (thread.parent_message) { self.$el.remove(); self.parent_thread.compose_message = null; } else { @@ -410,7 +410,9 @@ openerp.mail = function (session) { this.show_composer = !this.show_composer || this.stay_open; this.reinit(); } - this.$('textarea:not(.oe_compact):first').focus(); + if (!this.stay_open && this.show_composer) { + this.$('textarea:not(.oe_compact):first').focus(); + } return true; }, @@ -740,10 +742,10 @@ openerp.mail = function (session) { var self=this; //graphic effects if (fadeTime) { - self.$el.fadeOut(options.fadeTime, function () { + self.$el.fadeOut(fadeTime, function () { self.parent_thread.message_to_expandable(self); }); - self.thread.$el.fadeOut(options.fadeTime); + self.thread.$el.fadeOut(fadeTime); } else { self.parent_thread.message_to_expandable(self); }