diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 5695eb9ffc4..874a0e87a11 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -268,6 +268,17 @@ clip: rect(5px, 40px, 45px, 0px); } +.openerp .oe_mail_invisible { + display: none; +} + +.openerp ul.oe_mail_debug { + color: #888; +} + +.openerp ul.oe_mail_debug li { + margin-right: 12px; +} /* ------------------------------------------------------------ */ /* mail.compose.message form view diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 54bb5a9701f..21fcf650b62 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -134,7 +134,7 @@ openerp.mail = function(session) { /** Removes html tags, except b, em, br, ul, li */ do_text_remove_html_tags: function (string) { - var html = $('
').text(string.replace(/\s+/g, ' ')).html().replace(new RegExp('<(/)?(b|em|br|br /|ul|li)\\s*>', 'gi'), '<$1$2>'); + var html = $('
').text(string.replace(/\s+/g, ' ')).html().replace(new RegExp('<(/)?(b|em|br|br /|ul|li|div)\\s*>', 'gi'), '<$1$2>'); return html; }, @@ -432,7 +432,7 @@ openerp.mail = function(session) { start: function() { this._super.apply(this, arguments); // add events - this.add_events(); + this.bind_events(); // display user, fetch comments this.display_current_user(); if (this.params.records) var display_done = this.display_comments_from_parameters(this.params.records); @@ -462,8 +462,12 @@ openerp.mail = function(session) { do_customize_display: function() { if (this.display.show_post_comment) { this.$element.find('div.oe_mail_thread_action').eq(0).show(); } }, - - add_events: function() { + + + /** + * Bind events in the widget. Each event is slightly described + * in the function. */ + bind_events: function() { var self = this; // generic events from Chatter Mixin mail.ChatterUtils.do_bind_chatter_events(this); @@ -483,6 +487,12 @@ openerp.mail = function(session) { act_dom.toggle(); event.preventDefault(); }); + // event: click on 'attachment(s)' in msg + this.$element.delegate('a.oe_mail_msg_view_attachments', 'click', function (event) { + var act_dom = $(this).parent().parent().parent().find('.oe_mail_msg_attachments'); + act_dom.toggle(); + event.preventDefault(); + }); // event: click on 'Delete' in msg side menu this.$element.find('div.oe_mail_thread_display').delegate('a.oe_mail_msg_delete', 'click', function (event) { if (! confirm(_t("Do you really want to delete this message?"))) { return false; } @@ -522,17 +532,17 @@ openerp.mail = function(session) { event.preventDefault(); return call_defer; }); - // event: click on "reply by email" in msg side menu + // event: click on "Reply" in msg side menu (email style) this.$element.find('div.oe_mail_thread_display').delegate('a.oe_mail_msg_reply_by_email', 'click', function (event) { var msg_id = event.srcElement.dataset.msg_id; if (! msg_id) return false; self.instantiate_composition_form('reply', msg_id); event.preventDefault(); }); - // event: click on 'attachment(s)' in msg - this.$element.delegate('a.oe_mail_msg_view_attachments', 'click', function (event) { - var act_dom = $(this).parent().parent().parent().find('.oe_mail_msg_attachments'); - act_dom.toggle(); + // event: click on "Debug data" in msg side menu (email style) + this.$element.find('div.oe_mail_thread_display').delegate('a.oe_mail_msg_debug', 'click', function (event) { + var act_dom = $(event.srcElement).parents('div.oe_mail_msg_content').find('ul.oe_mail_debug'); + act_dom.toggleClass('oe_mail_invisible'); event.preventDefault(); }); }, diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 7e88e1e5bc7..4f077d0bc31 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -146,6 +146,21 @@
+ +