[FIX] mail: read more: prevent default

Long messages are not displayed entirely, but a 'read more' button is displayed
and allows to show the whole message. This button is an <a> inside a <span>,
both having classname 'oe_mail_expand'. Also note that messages are html, not
plain text.

Sometimes, the long message is truncated at some point that the 'read more' is
inserted inside an <a>, which is not html valid (nested links). In this case,
the browser automatically moves the inner <a> out of the outer one.

Unfortunately, when that happens, clicking on 'read more' redirects to the app
switcher because of missing prevent_default(), as the event handler was bound
on the <span> clicked, not the inner <a>.

This rev. simply binds the handler on 'oe_mail_expand', not specifically on
its <span>.
This commit is contained in:
Aaron Bohy
2015-12-07 16:32:27 +01:00
parent 88c5a90677
commit 169f819ab1
+1 -1
View File
@@ -34,7 +34,7 @@ var Thread = Widget.extend({
this.$('.o_thread_message').removeClass('o_thread_selected_message');
$(event.currentTarget).toggleClass('o_thread_selected_message', !selected);
},
"click span.oe_mail_expand": function (event) {
"click .oe_mail_expand": function (event) {
event.preventDefault();
var $source = $(event.currentTarget);
$source.parents('.o_thread_message_core').find('.o_mail_body_short').toggle();