diff options
| author | Thibault Delavallée <tde@openerp.com> | 2012-03-02 18:07:49 +0100 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2012-03-02 18:07:49 +0100 |
| commit | 5b2b9fb1abe76a0f1b0bb2c0231bca26e5ee218a (patch) | |
| tree | 38aec157c165b2abf49b4fc2b33f0668a0bac3e2 /addons/mail/static/src | |
| parent | 4847f720442c3fa6faefa60398d245c5814eb2c1 (diff) | |
[ADD] Added a thread model in display. Seems working but needs refactoring in the next few days.
bzr revid: tde@openerp.com-20120302170749-gaxx90sxy7bi97b3
Diffstat (limited to 'addons/mail/static/src')
| -rw-r--r-- | addons/mail/static/src/css/mail.css | 55 | ||||
| -rw-r--r-- | addons/mail/static/src/js/mail.js | 316 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/mail.xml | 51 |
3 files changed, 285 insertions, 137 deletions
diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 6b9b1e5c1c6..4f0eea033ea 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -1,4 +1,6 @@ -/* Wall */ +/* ------------------------------ */ +/* Wall */ +/* ------------------------------ */ .oe_mail_wall { overflow: auto; @@ -6,6 +8,10 @@ color: #4C4C4C; } +.oe_mail_wall_search { + width: 55%; +} + /* 2 columns view */ .oe_mail_wall_left { float: left; @@ -27,9 +33,11 @@ padding: 2px; } -/* Thread */ +/* ------------------------------ */ +/* RecordThread */ +/* ------------------------------ */ -.oe_mail_thread_main { +.oe_mail_recthread { overflow: auto; padding: 5px 5px 5px 5px; } @@ -46,15 +54,15 @@ .oe_mail_followers_action, .oe_mail_followers_display { } -/* Thread: 2 columns view */ -.oe_mail_thread_left { +/* RecordThread: 2 columns view */ +.oe_mail_recthread_left { float: left; - width: 65%; + width: 55%; } -.oe_mail_thread_right { +.oe_mail_recthread_right { float: right; - width: 34%; + width: 35%; } .oe_mail_button_follow, .oe_mail_button_unfollow, .oe_mail_button_followers { @@ -71,30 +79,28 @@ width: 80%; } -.oe_mail_thread_more, .oe_mail_thread_nomore { - margin-left: 20%; - margin-right: 40%; - border: 1px solid #D2D9E7; - background: #E0E0E0; - text-align: center; -} - -/* ThreadDisplay */ +/* ------------------------------ */ +/* ThreadDisplay */ +/* ------------------------------ */ .oe_mail_thread { } -.oe_mail_thread_act { +.oe_mail_thread_display, .oe_mail_thread_act { + white-space: normal; + margin-bottom: 5px; + border-bottom: 1px solid #D2D9E7; } -.oe_mail_thread_display { +.oe_mail_thread_subthread { + padding-left: 25%; } -.oe_mail_thread_msg, .oe_mail_thread_act { - width: 80%; - white-space: normal; - margin-bottom: 5px; - border-bottom: 1px solid #D2D9E7; +.oe_mail_thread_more { + margin-left: 20%; + margin-right: 40%; + border: 1px solid #D2D9E7; + text-align: center; } .notification { @@ -116,7 +122,6 @@ } .oe_mail_action_textarea { - width: 80%; height: 50px; padding: 5px; } diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index b8a82ff0192..2e270bd82a0 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -4,13 +4,29 @@ openerp.mail = function(session) { /* Add ThreadDisplay widget to registry */ session.web.form.widgets.add( - 'ThreadDisplay', 'openerp.mail.ThreadDisplay'); + 'Thread', 'openerp.mail.Thread'); session.web.page.readonly.add( - 'ThreadDisplay', 'openerp.mail.ThreadDisplay'); + 'Thread', 'openerp.mail.Thread'); - /* ThreadDisplay widget: display a thread of comments */ - mail.ThreadDisplay = session.web.Widget.extend({ - template: 'ThreadDisplay', + /** + * ThreadDisplay widget: this widget handles the display of a thread of messages. + * Two displays are managed through the [thread_level] parameter that sets + * the level number in the thread: + * 1/ 1-level thread: thread_level = 1 + * - root message + * - - sub message (parent_id = root message) + * - - sub message (parent_id = root message) + * 2/ flat thread: thread_level = 0 + * - root message + * - sub message (parent_id = root message) + * - sub message (parent_id = root message) + * This widget has 2 ways of initialization: + * 1/ give records + * 2/ do not give records: will fetch [limit] messages from + * the database, related to record [res_model]:[res_id]. + */ + mail.Thread = session.web.Widget.extend({ + template: 'Thread', /** * @@ -18,22 +34,31 @@ openerp.mail = function(session) { * @params {Object} [params] * @param {String} [params.res_model] res_model of mail.thread object * @param {Number} [params.res_id] res_id of record + * @param {Number} [params.parent_id=false] parent_id of message * @param {Number} [params.uid] user id - * @param {Number} [params.char_show_more=100] number of character to display before adding a "show more" + * @param {Number} [params.thread_level=0] number of levels in the thread (only 0 or 1 currently) + * @param {Number} [params.msg_more_limit=100] number of character to display before having a "show more" link; + * note that the text will not be truncated if it does not have 110% of + * the parameter (ex: 110 characters needed to be truncated and be displayed + * as a 100-characters message) * @param {Number} [params.limit=10] maximum number of messages to fetch - * @param {Number} [params.offset=0] offset for fetchign messages + * @param {Number} [params.offset=0] offset for fetching messages * @param {Number} [params.records=null] records to show instead of fetching messages */ init: function(parent, params) { this._super(parent); this.params = params; - this.params.limit = this.params.limit || 10; + this.params.parent_id = this.params.parent_id || false; + this.params.thread_level = this.params.thread_level || 0; + this.params.msg_more_limit = this.params.msg_more_limit || 100; + this.params.limit = this.params.limit || 2; this.params.offset = this.params.offset || 0; this.params.records = this.params.records || null; - this.params.char_show_more = this.params.char_show_more || 100; + /* DataSets and internal vars */ + this.parent_stack = []; + this.cur_thread_level = 0; this.map_hash = {}; - this.params.show_more = true; - /* define DataSets */ + this.params.thread_show_more = true; this.ds = new session.web.DataSet(this, this.params.res_model); this.ds_users = new session.web.DataSet(this, 'res.users'); }, @@ -42,27 +67,27 @@ openerp.mail = function(session) { var self = this; this._super.apply(this, arguments); /* events */ + this.$element.find('p.oe_mail_p_nomore').hide(); this.$element.find('button.oe_mail_button_comment').bind('click', function () { self.do_comment(); }); this.$element.find('button.oe_mail_button_more').bind('click', function () { self.do_more(); }); this.$element.find('div.oe_mail_thread_display').delegate('a.intlink', 'click', function (event) { // lazy implementation: fetch data and try to redirect if (! event.srcElement.dataset.resModel) return false; else var res_model = event.srcElement.dataset.resModel; - if (! event.srcElement.dataset.resLogin) return false; - else var res_login = event.srcElement.dataset.resLogin; - var ds = new session.web.DataSet(self, res_model); - var defer = ds.call('search', [[['login', '=', res_login]]]).then(function (records) { - if (records[0]) { - self.do_action({ - type: 'ir.actions.act_window', - res_model: res_model, - res_id: parseInt(records[0]), - views: [[false, 'form']] - }); - } - }); + var res_login = event.srcElement.dataset.resLogin; + var res_id = event.srcElement.dataset.resId; + if ((! res_login) && (! res_id)) return false; + if (! res_id) { + var ds = new session.web.DataSet(self, res_model); + var defer = ds.call('search', [[['login', '=', res_login]]]).then(function (records) { + if (records[0]) { + self.do_action({ type: 'ir.actions.act_window', res_model: res_model, res_id: parseInt(records[0]), views: [[false, 'form']]}); + } + else return false; + }); + } + else self.do_action({ type: 'ir.actions.act_window', res_model: res_model, res_id: parseInt(res_id), views: [[false, 'form']]}); }); - this.$element.find('div.oe_mail_thread_nomore').hide(); /* display user, fetch comments */ this.display_current_user(); if (this.params.records) return this.display_comments(this.params.records); @@ -77,72 +102,164 @@ openerp.mail = function(session) { var self = this; this.params.offset = 0; this.$element.find('div.oe_mail_thread_display').empty(); - return this.fetch_comments().then(); + return this.fetch_comments(this.params.limit, this.params.offset).then(); }, fetch_comments: function (limit, offset) { var self = this; var defer = this.ds.call('message_load', [[this.params.res_id], limit=(limit||this.params.limit), offset=(offset||this.params.offset)]); $.when(defer).then(function (records) { - if (records.length < self.params.limit) self.params.show_more = false; + if (records.length < self.params.limit) self.params.thread_show_more = false; self.display_comments(records); - if (self.params.show_more == true) { - self.$element.find('div.oe_mail_thread_more').show(); - self.$element.find('div.oe_mail_thread_nomore').hide(); } + if (self.params.thread_show_more == true) { + self.$element.find('button.oe_mail_button_more').show(); + self.$element.find('p.oe_mail_p_nomore').hide(); } else { - self.$element.find('div.oe_mail_thread_more').hide(); - self.$element.find('div.oe_mail_thread_nomore').show(); } + self.$element.find('button.oe_mail_button_more').hide(); + self.$element.find('p.oe_mail_p_nomore').show(); } }); return defer; }, display_comments: function (records) { var self = this; + // sort comments + var sorted_comments = this.sort_comments(records); + this.sorted_comments = sorted_comments; + this.bidouille = false; + this.sub_com = []; + console.log('display_comments'); + console.log(sorted_comments); + console.log(records); + //return true; + /* WIP: map matched regexp -> records to browse with name */ //_(records).each(function (record) { //self.do_check_internal_links(record.body_text); //}); - _(records).each(function (record) { - if (record.type == 'email') { record.mini_url = ('/mail/static/src/img/email_icon.png'); } - else { record.mini_url = self.thread_get_avatar_mini('res.users', 'avatar_mini', record.user_id[0]); } + + _(sorted_comments).each(function (record) { + console.log('new iteration'); + var sub_comments = [] - // body text manipulation - record.body_text = self.do_clean_text(record.body_text); - record.tr_body_text = self.do_truncate_string(record.body_text, self.params.char_show_more); - record.body_text = self.do_replace_internal_links(record.body_text); - if (record.tr_body_text) record.tr_body_text = self.do_replace_internal_links(record.tr_body_text); - - // render - $(session.web.qweb.render('ThreadMsg', {'record': record})).appendTo(self.$element.find('div.oe_mail_thread_display')); + if (record.parent_id == self.params.parent_id && self.params.thread_level > 0) { + if (! self.bidouille) { + self.bidouille = record; + } + else { + self.thread = new mail.Thread(self, {'res_model': self.params.res_model, 'res_id': self.params.res_id, 'uid': self.params.uid, + 'records': self.sub_com, 'thread_level': (self.params.thread_level-1), + 'parent_id': record.id}); + self.$element.find('div.oe_mail_thread_msg:last').append('<div class="oe_mail_thread_subthread"/>'); + self.thread.appendTo(self.$element.find('div.oe_mail_thread_subthread:last')); + self.bidouille = record; + self.sub_com = []; + } + + } - // truncated: hide full-text, show summary, add buttons - if (record.tr_body_text) { - var node = self.$element.find('span.oe_mail_msg_body:last').append(' <a href="#" class="reduce">[ ... Show less]</a>'); - self.$element.find('p.oe_mail_msg_p:last').append($('<span class="oe_mail_msg_body_short">' + record.tr_body_text + ' <a href="#" class="expand">[ ... Show more]</a></span>')); - var new_node = self.$element.find('span.oe_mail_msg_body_short:last'); - node.hide(); - node.find('a:last').click(function() { node.hide(); new_node.show(); return false; }); - new_node.find('a:last').click(function() { new_node.hide(); node.show(); return false; }); + else if (self.params.thread_level > 0) { + self.sub_com.push(record); + return true; } + + self.display_comment(record); + }); + console.log(self.sub_com); + if (self.sub_com.length > 0) { + self.thread = new mail.Thread(self, {'res_model': self.params.res_model, 'res_id': self.params.res_id, 'uid': self.params.uid, + 'records': self.sub_com, 'thread_level': (self.params.thread_level-1), + 'parent_id': self.bidouille.id}); + self.$element.find('div.oe_mail_thread_msg:last').append('<div class="oe_mail_thread_subthread"/>'); + self.thread.appendTo(self.$element.find('div.oe_mail_thread_subthread:last')); + self.sub_com = []; + } + + console.log('end display'); // update offset for "More" buttons this.params.offset += records.length; }, + + /** + * Display a record + */ + display_comment: function (record) { + if (record.type == 'email') { record.mini_url = ('/mail/static/src/img/email_icon.png'); } + else { record.mini_url = this.thread_get_avatar_mini('res.users', 'avatar_mini', record.user_id[0]); } + // body text manipulation + record.body_text = this.do_clean_text(record.body_text); + record.tr_body_text = this.do_truncate_string(record.body_text, this.params.msg_more_limit); + record.body_text = this.do_replace_internal_links(record.body_text); + if (record.tr_body_text) record.tr_body_text = this.do_replace_internal_links(record.tr_body_text); + // render + $(session.web.qweb.render('ThreadMsg', {'record': record})).appendTo(this.$element.find('div.oe_mail_thread_display')); + // truncated: hide full-text, show summary, add buttons + if (record.tr_body_text) { + var node_body = this.$element.find('span.oe_mail_msg_body:last').append(' <a href="#" class="reduce">[ ... Show less]</a>'); + var node_body_short = this.$element.find('span.oe_mail_msg_body_short:last').append(' <a href="#" class="expand">[ ... Show more]</a>'); + node_body.hide(); + node_body.find('a:last').click(function() { node_body.hide(); node_body_short.show(); return false; }); + node_body_short.find('a:last').click(function() { node_body_short.hide(); node_body.show(); return false; }); + } + }, + + /** + * Sorts records in an hierarchical way, based on parent_id + * @param {Array} records records from mail.message + * @returns {Object} sorted_comments: dict + * sorted_comments.res_model = {res_ids} + * sorted_comments.res_model.res_id = [records] + */ + sort_comments: function (records) { + //console.log('sort_comments'); + if (this.params.thread_level == 0) return records.slice(0); + + var done = false; + var cur_iter = 0; + var max_iter = 10; + + sorted_comments = []; + + tmp_records = records.slice(0); + + _(records).each(function (record, id) { + if (! record.parent_id) { + sorted_comments.push(record); + } + }); + + records.reverse(); + + _(records).each(function (record, id) { + var index = _.indexOf(_.pluck(sorted_comments, 'id'), record.parent_id[0]); + index = 0; + if (index > -1) { + if (record.parent_id) { + sorted_comments.splice(index+1, 0, record); + } + } + }); + + records.reverse(); + return sorted_comments; + }, display_current_user: function () { - $('<div>').html( - '<img src="' + this.thread_get_avatar_mini('res.users', 'avatar_mini', this.params.uid) + '"/>' - ).appendTo(this.$element.find('div.oe_mail_msg_image')); + return this.$element.find('div.oe_mail_msg_image').empty().html( + '<img src="' + this.thread_get_avatar_mini('res.users', 'avatar_mini', this.params.uid) + '"/>'); }, do_comment: function () { var body_text = this.$element.find('textarea').val(); - return this.ds.call('message_append_note', [[this.params.res_id], 'Reply comment', body_text, type='comment']).then( - this.proxy('init_comments')); + console.log(body_text + this.params.parent_id); + return true; + //return this.ds.call('message_append_note', [[this.params.res_id], 'Reply comment', body_text, parent_id=this.params.parent_id, type='comment']).then( + //this.proxy('init_comments')); }, do_more: function () { - return this.fetch_comments(this.limit, this.offset); + return this.fetch_comments(this.params.limit, this.params.offset); }, do_replace_internal_links: function (string) { @@ -205,20 +322,20 @@ openerp.mail = function(session) { /* Add ThreadView widget to registry */ session.web.form.widgets.add( - 'ThreadView', 'openerp.mail.ThreadView'); + 'ThreadView', 'openerp.mail.RecordThread'); session.web.page.readonly.add( - 'ThreadView', 'openerp.mail.ThreadView'); + 'ThreadView', 'openerp.mail.RecordThread'); /* ThreadView widget: thread of comments */ - mail.ThreadView = session.web.form.Field.extend({ + mail.RecordThread = session.web.form.Field.extend({ // QWeb template to use when rendering the object - form_template: 'Thread', + form_template: 'RecordThread', init: function() { this.is_sub = 0; this.see_sub = 0; this._super.apply(this, arguments); - this.thread_display = null; + this.thread = null; /* DataSets */ this.ds = new session.web.DataSet(this, this.view.model); this.ds_users = new session.web.DataSet(this, 'res.users'); @@ -252,9 +369,10 @@ openerp.mail = function(session) { /* fetch subscribers */ this.fetch_subscribers(); /* create ThreadDisplay widget and render it */ - this.$element.find('div.oe_mail_thread_left').empty(); - this.thread_display = new mail.ThreadDisplay(this, {'res_model': this.view.model, 'res_id': this.view.datarecord.id, 'uid': this.session.uid}); - this.thread_display.appendTo(this.$element.find('div.oe_mail_thread_left')); + this.$element.find('div.oe_mail_recthread_left').empty(); + if (this.thread) this.thread.stop(); + this.thread = new mail.Thread(this, {'res_model': this.view.model, 'res_id': this.view.datarecord.id, 'uid': this.session.uid}); + this.thread.appendTo(this.$element.find('div.oe_mail_recthread_left')); }, fetch_subscribers: function () { @@ -413,7 +531,7 @@ openerp.mail = function(session) { */ fetch_comments: function (domain, context, offset, limit) { var load_res = this.ds_thread.call('get_pushed_messages', - [[this.session.uid], limit = (limit || 100), offset = (offset || 0), domain = (domain || null), context = (context || null) ]).then( + [[this.session.uid], limit = (limit || 2), offset = (offset || 0), domain = (domain || []), context = (context || null) ]).then( this.proxy('display_comments')); return load_res; }, @@ -422,20 +540,24 @@ openerp.mail = function(session) { * @param {Array} records records to show in threads */ display_comments: function (records) { - var sorted_comments = this.sort_comments(records, this.sorted_comments); + var sorted_comments = this.sort_comments(records); var self = this; - _(sorted_comments).each(function (rec_models, model) { // each model - _(rec_models).each(function (record_id, id) { // each record + _(sorted_comments.model_list).each(function (model_name) { + _(sorted_comments.models[model_name].id_list).each(function (id) { + var records = sorted_comments.models[model_name].ids[id]; + console.log('records to send'); + console.log(records); var template = 'WallThreadContainer'; var render_res = session.web.qweb.render(template, { - 'record_model': model, + 'record_model': model_name, 'record_id': id, }); $('<div class="oe_mail_wall_thread">').html(render_res).appendTo(self.$element.find('div.oe_mail_wall_threads')); - var thread_display = new mail.ThreadDisplay(self, - {'res_model': model, 'res_id': parseInt(id), 'uid': self.session.uid, 'records': record_id} + var thread = new mail.Thread(self, { + 'res_model': model_name, 'res_id': parseInt(id), 'uid': self.session.uid, 'records': records, + 'parent_id': false, 'thread_level': 1} ); - thread_display.appendTo(self.$element.find('div.oe_mail_wall_thread_content:last')); + thread.appendTo(self.$element.find('div.oe_mail_wall_thread_content:last')); }); }); $.extend(true, this.sorted_comments, sorted_comments); @@ -447,16 +569,49 @@ openerp.mail = function(session) { * @returns {Object} sorted_comments: dict * sorted_comments.res_model = {res_ids} * sorted_comments.res_model.res_id = [records] + * sorted = [{'hr_holidays': [{3: 'A'}, {2: 'B'}]}, {'crm': [{3: 'A'}, {2: 'B'}]}] */ sort_comments: function (records) { - sorted_comments = {} + sc = {'model_list': [], 'models': {}} + var cur_iter = 0; var max_iter = 10; var modif = true; + /* step1: get roots */ + while ( modif && (cur_iter++) < max_iter) { + modif = false; + _(records).each(function (record) { + if ($.inArray(record.model, sc['model_list']) == -1) { + sc['model_list'].push(record.model); + sc['models'][record.model] = {'id_list': [], 'id_to_root': {}, 'ids': {}}; + modif = true; + } + var sort_id = (record.parent_id) ? record.parent_id[0]: record.id; + if (record.parent_id == false) { + if (_.indexOf(sc['models'][record.model]['id_list'], sort_id) == -1) { + sc['models'][record.model]['id_list'].push(sort_id); + sc['models'][record.model]['ids'][sort_id] = []; + modif = true; + } + } + else { + var test = sc['models'][record.model]['id_to_root'][sort_id]; + if (_.indexOf(sc['models'][record.model]['id_list'], sort_id) != -1) { + sc['models'][record.model]['id_to_root'][record.id] = sort_id; + modif = true; + } + else if ( test ) { + sc['models'][record.model]['id_to_root'][record.id] = test; + modif = true; + } + } + }); + } + /* step2: add records */ _(records).each(function (record) { - if (! (record.model in sorted_comments)) { sorted_comments[record.model] = {}; } - if (! (record.res_id in sorted_comments[record.model])) { - sorted_comments[record.model][record.res_id] = []; } - sorted_comments[record.model][record.res_id].push(record); + var root_id = sc['models'][record.model]['id_to_root'][record.id]; + if (! root_id) root_id = record.id; + sc['models'][record.model]['ids'][root_id].push(record); }); - return sorted_comments; + console.log(sc); + return sc; }, /** @@ -472,7 +627,8 @@ openerp.mail = function(session) { _(rec_models).each(function (record_id, id) { // each record ids.push(id); }); - domain.push('|', ['model', '!=', model], ['res_id', 'not in', ids]); + //domain.push('|', ['model', '!=', model], ['res_id', 'not in', ids]); + domain.push('|', ['model', '!=', model], '!', ['id', 'child_of', ids]); }); return domain; }, diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 1e4e301bc2e..3020e9b5580 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -14,11 +14,8 @@ <div class="oe_mail_wall_threads"> </div> <div class="oe_mail_wall_more"> - <button class="oe_mail_wall_button_more" type="button">See more discussions - </button> - </div> - <div class="oe_mail_wall_nomore"> - You have loaded all discussions. + <button class="oe_mail_wall_button_more" type="button">See more discussions</button> + <p class="oe_mail_wall_nomore">You have loaded all discussions.</p> </div> </div> <div class="oe_mail_wall_right"> @@ -33,11 +30,11 @@ </div> </t> - <div t-name="Thread" class="oe_mail_thread_main"> + <div t-name="RecordThread" class="oe_mail_recthread"> <div class="separator horizontal">OpenSocial</div> - <div class="oe_mail_thread_left"> + <div class="oe_mail_recthread_left"> </div> - <div class="oe_mail_thread_right"> + <div class="oe_mail_recthread_right"> <div class="oe_mail_actions"> <button type="button" class="oe_mail_button_follow">Follow</button> <button type="button" class="oe_mail_button_unfollow">Unfollow</button> @@ -52,22 +49,18 @@ </div> </div> - <div t-name="ThreadDisplay" class="oe_mail_thread"> + <div t-name="Thread" class="oe_mail_thread"> <div class="oe_mail_thread_act"> - <div class="oe_mail_msg_image"> - </div> + <div class="oe_mail_msg_image">User_image</div> <div class="oe_mail_msg_content"> <textarea class="oe_mail_action_textarea" onfocus="this.value='';">Enter your comment here...</textarea><br /> <button type="button" class="oe_mail_button_comment">Post comment</button> </div> </div> - <div class="oe_mail_thread_display"> - </div> + <div class="oe_mail_thread_display"></div> <div class="oe_mail_thread_more"> - <button class="oe_mail_button_more" type="button">More</button> - </div> - <div class="oe_mail_thread_nomore"> - You have loaded all messages in this thread. + <button class="oe_mail_button_more" type="button">Load more messages</button> + <p class="oe_mail_p_nomore">You have loaded all messages in this thread.</p> </div> </div> @@ -76,31 +69,25 @@ <img t-att-src="record.mini_url"/> </div> <div class="oe_mail_msg_content"> - <t t-if="record.type == 'email'"> - <t t-call="EmailDisplay" /> - </t> - <t t-if="record.type == 'notification' || record.type == 'comment'"> - <t t-call="NotificationDisplay" /> - </t> + <t t-if="record.type == 'email'"><t t-call="EmailDisplay" /></t> + <t t-if="record.type == 'notification' || record.type == 'comment'"><t t-call="NoteDisplay" /></t> </div> + <t t-if="record.type == 'tmp'"><t t-call="ThreadDisplay" /></t> </div> - <t t-name="NotificationDisplay"> + <t t-name="NoteDisplay"> <p class="oe_mail_msg_p"> - <t t-if="record.type == 'notification'"> - <span class="oe_mail_msg_author">OpenERP System Notification</span> - </t> - <t t-if="record.type == 'comment'"> - <span class="oe_mail_msg_author"> - <a href="#" data-res-model='res.users' t-attf-data-res-id='{record.user_id[0]}'><t t-raw="record.user_id[1]"/></a> - </span> - </t> + <span class="oe_mail_msg_author"> + <a href="#" class="intlink" data-res-model='res.users' t-attf-data-res-id='{record.user_id[0]}'><t t-raw="record.user_id[1]"/></a> + <t t-if="record.type == 'notification'">via OpenERP System Notification</t> + </span> <t t-if="record.need_action_user_id != false"> - <span class="oe_mail_msg_need_action">Need action by <a href="#"><t t-raw="record.need_action_user_id[1]"/></a></span> </t> wrote on <span class="oe_mail_msg_date"><t t-raw="record.date"/></span> <br /> <span class="oe_mail_msg_body"><t t-raw="record.body_text"/></span> + <t t-if="record.tr_body_text"><span class="oe_mail_msg_body_short"><t t-raw="record.tr_body_text"/></span></t> </p> </t> |
