From 7429f3bfb6797b1bdd97e05afdd5992a3bd320ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 21 Feb 2012 16:39:42 +0100 Subject: [PATCH] [IMP] Slighty improved wall widget. bzr revid: tde@openerp.com-20120221153942-mue1h18f2fjluf27 --- addons/mail/static/src/css/mail.css | 5 +++++ addons/mail/static/src/js/mail.js | 27 ++++++++++++--------------- addons/mail/static/src/xml/mail.xml | 10 ++++++---- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 0d153ce0c06..be5e8425630 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -5,6 +5,11 @@ padding: 5px 5px 5px 5px; } +.oe_mail_wall_main { + overflow: auto; + padding: 5px 5px 5px 5px; +} + /* 2 columns view */ .oe_mail_main_left { float: left; diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index b9404885b6a..cd2e1f2ac5d 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -34,7 +34,6 @@ openerp.mail = function(session) { }, stop: function () { - console.log('stop'); this._super.apply(this, arguments); }, @@ -134,39 +133,37 @@ openerp.mail = function(session) { start: function() { var self = this; this._super.apply(this, arguments); - console.log(this); - self.$element.find('button.oe_mail_action_comment').bind('click', function () { self.do_comment(); }); - this.ds_msg.call('get_pushed_messages', [[], self.filter_search]).then( - this.proxy('display_records')); + self.$element.find('button.oe_mail_button_comment').bind('click', function () { self.do_comment(); }); + return this.fetch_comments(); }, stop: function () { this._super(); }, - fetch_messages: function () { - console.log('debug--fetch_messages'); - return this.ds_msg.call('get_pushed_messages', []).then( - this.proxy('display_records')); + fetch_comments: function () { + var load_res = this.ds_msg.call('get_pushed_messages', [[this.session.uid]]).then( + this.proxy('display_comments')); + return load_res; }, - display_records: function (records) { - this.$element.find('div.oe_mail_comments').empty(); + display_comments: function (records) { + this.$element.find('div.oe_mail_msg').empty(); var self = this; _(records).each(function (record) { + console.log(record); var template = 'ThreadMsgView'; var render_res = session.web.qweb.render(template, { 'record': record, }); - $('
').html(render_res).appendTo(self.$element.find('div.oe_mail_comments')); + $('
').html(render_res).appendTo(self.$element.find('div.oe_mail_msg')); }); -// this.timeout = setTimeout(this.proxy('fetch_messages'), 5000); }, do_comment: function () { var body_text = this.$element.find('textarea').val(); - return this.ds.call('message_append_note', [[this.view.datarecord.id], 'Reply comment', body_text, type='comment']).then( - this.proxy('fetch_messages')); + return this.ds_msg.call('create', [{'subject': 'Status tweet', 'model': 'res.users', 'body_text': body_text, 'type': 'comment'}]).then( + this.proxy('fetch_comments')); }, }); }; diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 50e73f10326..ff69ef4c29f 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -47,12 +47,14 @@
-
+
-
- +
+
-
+
+
+