diff options
| author | Thibault Delavallée <tde@openerp.com> | 2012-03-27 11:15:04 +0200 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2012-03-27 11:15:04 +0200 |
| commit | 5ac5299eaa1e096487ca457ca4aab8d60cc11540 (patch) | |
| tree | 1fac14a11067331cd2a8c7af9a0f61bfb80524b6 /addons/mail/static/src | |
| parent | 8405345bcf8337271fd3e4ae6cf01448c4836684 (diff) | |
[IMP] Thread widget: 'load more' button hidden by default, shown only if necessary. Otherwise the display was a bit screwed.
bzr revid: tde@openerp.com-20120327091504-8ydi6csctn0nwcuz
Diffstat (limited to 'addons/mail/static/src')
| -rw-r--r-- | addons/mail/static/src/css/mail.css | 1 | ||||
| -rw-r--r-- | addons/mail/static/src/js/mail.js | 36 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/mail.xml | 2 |
3 files changed, 17 insertions, 22 deletions
diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 5cc8d821c21..9630838a98f 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -107,6 +107,7 @@ div.oe_mail_thread_subthread { } div.oe_mail_thread_more { + display: none; border-bottom: 1px solid #D2D9E7; } diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index a55e4c841e2..4e56c7d1a9a 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -50,7 +50,6 @@ openerp.mail = function(session) { this.ds = new session.web.DataSet(this, this.params.res_model); this.ds_users = new session.web.DataSet(this, 'res.users'); this.ds_msg = new session.web.DataSet(this, 'mail.message'); - this.name = 'Unknown record' this.sorted_comments = {'root_ids': [], 'root_id_msg_list': {}}; // display customization vars this.display = {}; @@ -65,21 +64,16 @@ openerp.mail = function(session) { start: function() { this._super.apply(this, arguments); - var self = this; // customize display if (! this.display.show_post_comment) this.$element.find('div.oe_mail_thread_act').hide(); - if (! this.display.show_more) this.$element.find('div.oe_mail_thread_more').hide(); + //if (this.display.show_more) this.$element.find('div.oe_mail_thread_more').show(); // add events this.add_events(); - // get record name - var name_get_done = self.ds.name_get([this.params.res_id]).then(function (records) { self.name = records[0][1]; }); - var display_done = $.when(name_get_done).then(function () { - /* display user, fetch comments */ - self.display_current_user(); - if (self.params.records) return self.fetch_comments_tmp(self.params.records); - else return self.init_comments(); - }); - return display_done && name_get_done + /* display user, fetch comments */ + this.display_current_user(); + if (this.params.records) var display_done = this.fetch_comments_tmp(this.params.records); + else var display_done = this.init_comments(); + return display_done }, add_events: function() { @@ -163,25 +157,25 @@ openerp.mail = function(session) { var self = this; var defer = this.ds.call('message_load', [[this.params.res_id], 1, 0, [ ['id', 'child_of', this.params.parent_id], ['id', '!=', this.params.parent_id]] ]); $.when(defer).then(function (records) { - console.log(records); + //console.log(records); if (records.length <= 0) self.display.show_more = false; self.display_comments(records_good); - if (self.display.show_more == false) { - self.$element.find('button.oe_mail_button_more:last').hide(); } + if (self.display.show_more == true) self.$element.find('div.oe_mail_thread_more:last').show(); + else self.$element.find('div.oe_mail_thread_more:last').hide(); }); return defer; }, fetch_comments: function (limit, offset, domain) { - console.log('fetch comments'); + //console.log('fetch comments'); var self = this; var defer = this.ds.call('message_load', [[this.params.res_id], ( (limit+1)||(this.params.limit+1) ), (offset||this.params.offset), (domain||[]), (this.params.thread_level > 0), (this.sorted_comments['root_ids'])]); $.when(defer).then(function (records) { if (records.length <= self.params.limit) self.display.show_more = false; else records.pop(); self.display_comments(records); - if (self.display.show_more == false) { - self.$element.find('button.oe_mail_button_more:last').hide(); } + if (self.display.show_more == true) self.$element.find('div.oe_mail_thread_more:last').show(); + else self.$element.find('div.oe_mail_thread_more:last').hide(); }); return defer; }, @@ -351,8 +345,8 @@ openerp.mail = function(session) { do_more: function () { domain = this.get_fetch_domain(this.sorted_comments); - console.log(domain); - console.log(this.params.limit + '-' + this.params.offset + '-' + this.params.parent_id + '-' + this.params.res_id); + //console.log(domain); + //console.log(this.params.limit + '-' + this.params.offset + '-' + this.params.parent_id + '-' + this.params.res_id); //return true; return this.fetch_comments(this.params.limit, this.params.offset, domain); }, @@ -652,7 +646,7 @@ openerp.mail = function(session) { */ display_comments: function (records) { var sorted_comments = this.sort_comments(records); - console.log(sorted_comments); + //console.log(sorted_comments); var self = this; _(sorted_comments.model_list).each(function (model_name) { _(sorted_comments.models[model_name].root_ids).each(function (id) { diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index bcaff9570c5..b9de27ca6e9 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -64,7 +64,7 @@ <t t-name="NoteDisplay"> <p class="oe_mail_msg"> - <a href="#" class="intlink oe_mail_oe_intlink" t-attf-data-res-model='{params.res_model}' t-attf-data-res-id='{params.res_id}'><t t-raw="thread.name"/></a> + <a href="#" class="intlink oe_mail_oe_intlink" t-attf-data-res-model='{params.res_model}' t-attf-data-res-id='{params.res_id}'><t t-raw="record.record_name"/></a> <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> <br /> |
