summaryrefslogtreecommitdiff
path: root/addons/mail/static/src
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2012-07-11 13:17:22 +0200
committerThibault Delavallée <tde@openerp.com>2012-07-11 13:17:22 +0200
commit537aa86ee2017f53cbddfa0cc2e4ab99ba816d31 (patch)
treee2433e79f061782937db0edfe09b54816f4ae287 /addons/mail/static/src
parent4f5537541ffa43d120cff470d39382cf943655fa (diff)
[IMP] mail: chatter js: added Debug data link, that toggles a div with some info about the message.
bzr revid: tde@openerp.com-20120711111722-lv0lo01ojwgw4at8
Diffstat (limited to 'addons/mail/static/src')
-rw-r--r--addons/mail/static/src/css/mail.css11
-rw-r--r--addons/mail/static/src/js/mail.js28
-rw-r--r--addons/mail/static/src/xml/mail.xml15
3 files changed, 45 insertions, 9 deletions
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 = $('<div/>').text(string.replace(/\s+/g, ' ')).html().replace(new RegExp('&lt;(/)?(b|em|br|br /|ul|li)\\s*&gt;', 'gi'), '<$1$2>');
+ var html = $('<div/>').text(string.replace(/\s+/g, ' ')).html().replace(new RegExp('&lt;(/)?(b|em|br|br /|ul|li|div)\\s*&gt;', '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 @@
<div t-if="params.thread_level > 0" class="oe_mail_msg_subtitle">
<a t-attf-href="#model=#{params.res_model}&amp;id=#{params.res_id}"><t t-raw="record.record_name"/></a>
</div>
+ <ul class="oe_mail_invisible oe_mail_debug">
+ <li>document: (<t t-raw="record.model"/>,<t t-raw="record.res_id"/>)</li>
+ <li>id: <t t-raw="record.id"/></li>
+ <li>type: <t t-raw="record.type"/></li>
+ <li>content_subtype: <t t-raw="record.content_subtype"/></li>
+ <li>parent_id: <t t-raw="record.parent_id"/></li>
+ <li>email_from: <t t-raw="record.email_from"/></li>
+ <li>email_to: <t t-raw="record.email_to"/></li>
+ <li>email_cc: <t t-raw="record.email_cc"/></li>
+ <li>email_bcc: <t t-raw="record.email_bcc"/></li>
+ <li>reply_to: <t t-raw="record.reply_to"/></li>
+ <li t-if="record.type == 'email'">message_id: <t t-raw="record.message_id"/></li>
+ <li t-if="record.type == 'email'">references: <t t-raw="record.references"/></li>
+ </ul>
+ <div class="oe_clear"/>
<div class="oe_mail_msg_body">
<a t-attf-href="#model=res.users&amp;id=#{record.user_id[0]}"><t t-raw="record.user_id[1]"/></a>
<div class="oe_mail_msg_record_body"><t t-raw="record.body"/></div>