diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 3f9fe3149d3..d4eb2373b66 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -1,39 +1,92 @@ -/** ThreadView widget **/ +/* Wall */ -.oe_mail_main { - overflow: auto; - padding: 5px 5px 5px 5px; -} - -.oe_mail_wall_main { +.oe_mail_wall { overflow: auto; padding: 5px 5px 5px 5px; } /* 2 columns view */ -.oe_mail_main_left { +.oe_mail_wall_left { float: left; width: 65%; } -.oe_mail_main_right { +.oe_mail_wall_right { float: right; width: 34%; } +.oe_mail_wall_thread_content { + margin-left: 5%; +} + + +/* Thread */ + +.oe_mail_thread_main { + overflow: auto; + padding: 5px 5px 5px 5px; +} + /* Left-side CSS */ .oe_mail_actions { margin-bottom: 10px; } -.oe_mail_post_comment { +.oe_mail_followers { margin-bottom: 10px; } +.oe_mail_followers_action, .oe_mail_followers_display { +} + +/* 2 columns view */ +.oe_mail_thread_left { + float: left; + width: 65%; +} + +.oe_mail_thread_right { + float: right; + width: 34%; +} + .oe_mail_button_follow, .oe_mail_button_unfollow, .oe_mail_button_followers { width: 120px; } +/* Subscribers */ +.oe_mail_followers_vignette { + float: left; + width: 20%%; +} + +.oe_mail_followers_vignette img { + width: 80%; +} + +/* ThreadDisplay */ + +.oe_mail_thread { +} + +.oe_mail_thread_act { +} + +.oe_mail_thread_display { +} + +.oe_mail_thread_msg, .oe_mail_thread_act { + white-space: normal; + margin-bottom: 5px; +} + +.oe_mail_thread_msg:after, .oe_mail_thread_act:after { + content: ""; + display: block; + clear: both; +} + .oe_mail_button_comment { width: 150px; } @@ -44,27 +97,10 @@ padding: 5px; } -.oe_mail_action_comment { -} - -.oe_mail_msg { -} - -.oe_mail_comment { - white-space: normal; - margin-bottom: 5px; -} - -.oe_mail_comment:after { - content: ""; - display: block; - clear: both; -} - .oe_mail_msg_image { float: left; - width: 100px; - height: 100px; + width: 60px; + height: 60px; text-align: center; overflow: hidden; -moz-border-radius: 3px; @@ -79,14 +115,14 @@ } .oe_mail_msg_image img { - width: 100px; + width: 60px; height: auto; clip: rect(10px, 100px, 110px, 0px); } .oe_mail_msg_content { - width: 85%; - margin-left: 15%; + width: 89%; + margin-left: 11%; } .oe_mail_msg_p { @@ -108,19 +144,3 @@ .oe_mail_msg_date, .oe_mail_msg_date a { color: #4E43E7; } - -/* Right-side CSS */ -.oe_mail_followers_vignette { - float: left; - width: 20%%; -} - -.oe_mail_followers_vignette img { - width: 80%; -} - -/* Wall CSS */ -.oe_mail_thread_content div.oe_mail_comment { - margin-left: 5%; -} - diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 2ef72d0b816..2f28ea12705 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -2,6 +2,92 @@ openerp.mail = function(session) { var mail = session.mail = {}; + /* Add ThreadDisplay widget to registry */ + session.web.form.widgets.add( + 'ThreadDisplay', 'openerp.mail.ThreadDisplay'); + session.web.page.readonly.add( + 'ThreadDisplay', 'openerp.mail.ThreadDisplay'); + + /* ThreadDisplay widget: display a thread of comments */ + mail.ThreadDisplay = session.web.Widget.extend({ + // QWeb template to use when rendering the object + template: 'ThreadDisplay', + + init: function(parent, params) { + this._super(parent); + this.res_model = params['res_model']; + this.res_id = params['res_id']; + this.uid = params['uid']; + /* DataSets */ + this.ds = new session.web.DataSet(this, this.res_model); + this.ds_users = new session.web.DataSet(this, 'res.users'); + }, + + start: function() { + var self = this; + this._super.apply(this, arguments); + /* bind buttons */ + this.$element.find('button.oe_mail_button_comment').bind('click', function () { self.do_comment(); }); + /* display user, fetch comments */ + this.display_current_user(); + this.fetch_comments(); + }, + + stop: function () { + this._super.apply(this, arguments); + }, + + fetch_comments: function () { + var load_res = this.ds.call('message_load', [[this.res_id]]).then( + this.proxy('display_comments')); + return load_res; + }, + + display_current_user: function () { + $('
- -
+
- -
+
-