[IMP] Cleaned xml, css and js for ThreadView.

bzr revid: tde@openerp.com-20120210105223-fv24nic79ycldc2i
This commit is contained in:
Thibault Delavallée 2012-02-10 11:52:23 +01:00
parent 62a33c175a
commit 5042ba2465
3 changed files with 93 additions and 41 deletions

View File

@ -1,43 +1,74 @@
/** ThreadView widget **/
.oe_mail_main {
overflow: auto;
padding: 5px 5px 5px 5px;
}
/* 2 columns view */
.oe_mail_main_left {
float: left;
width: 65%;
}
.oe_mail_main_right {
float: right;
width: 34%;
}
/* Left-side CSS */
.oe_mail_actions {
padding-bottom: 10px;
margin-bottom: 10px;
}
.oe_mail_post_comment {
width: 65%;
padding-bottom: 10px;
margin-bottom: 10px;
}
.oe_mail_comments {
width: 65%;
.oe_mail_button_follow, .oe_mail_button_unfollow, .oe_mail_button_getfollowers, .oe_mail_button_hidefollowers {
width: 100px;
}
.oe_mail_button_comment {
width: 150px;
}
.oe_mail_action_textarea {
width: 60%;
height: 50px;
padding: 5px;
}
.oe_mail_action_comment {
}
.oe_mail_msg {
width: 65%;
/* border: 1px solid #998877; */
padding: 10px 0px 10px 0px;
}
.oe_mail_msg:after {
/*.oe_mail_msg:after {
content: "";
display: block;
clear: both;
}*/
.oe_mail_comment {
white-space: normal;
margin-bottom: 5px;
}
.oe_mail_msg_image {
float: left;
width: 9%;
width: 14%;
}
.oe_mail_msg_image img {
width: 80%;
margin-left: 10%;
}
.oe_mail_msg_content {
width: 89%;
margin-left: 10%;
/* border: 1px solid #557722; */
overflow: hidden;
width: 85%;
margin-left: 15%;
}
.oe_mail_msg_p {
@ -48,14 +79,24 @@
.oe_mail_msg_body {
}
.oe_mail_msg_author {
.oe_mail_msg_author, .oe_mail_msg_author a {
color: #4E43E7;
}
.oe_mail_msg_need_action {
.oe_mail_msg_need_action, .oe_mail_msg_need_action a {
color: #C03000;
}
.oe_mail_msg_date {
.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%;
}

View File

@ -27,15 +27,15 @@ openerp.mail = function(session) {
var self = this;
this._super.apply(this, arguments);
/* bind follow and unfollow buttons */
self.$element.find('button.oe_mail_action_follow').bind('click', function () { self.do_follow(); });
self.$element.find('button.oe_mail_action_follow').hide();
self.$element.find('button.oe_mail_action_unfollow').bind('click', function () { self.do_unfollow(); });
self.$element.find('button.oe_mail_action_unfollow').hide();
self.$element.find('button.oe_mail_action_comment').bind('click', function () { self.do_comment(); });
self.$element.find('button.oe_mail_button_follow').bind('click', function () { self.do_follow(); });
self.$element.find('button.oe_mail_button_follow').hide();
self.$element.find('button.oe_mail_button_unfollow').bind('click', function () { self.do_unfollow(); });
self.$element.find('button.oe_mail_button_unfollow').hide();
self.$element.find('button.oe_mail_button_comment').bind('click', function () { self.do_comment(); });
/* find wich (un)follow buttons to show */
var call_res = this.ds.call('message_is_subscriber', [[this.session.uid]]).then(function (records) {
if (records == true) { self.follow_state = 1; self.$element.find('button.oe_mail_action_unfollow').show(); }
else { self.follow_state = 0; self.$element.find('button.oe_mail_action_follow').show(); }
if (records == true) { self.follow_state = 1; self.$element.find('button.oe_mail_button_unfollow').show(); }
else { self.follow_state = 0; self.$element.find('button.oe_mail_button_follow').show(); }
});
},
@ -56,27 +56,27 @@ openerp.mail = function(session) {
},
display_records: function (records) {
this.$element.find('div.oe_mail_comments').empty();
this.$element.find('div.oe_mail_msg').empty();
var self = this;
_(records).each(function (record) {
var template = 'ThreadMsgView';
var render_res = session.web.qweb.render(template, {
'record': record,
});
$('<div class="oe_mail_msg">').html(render_res).appendTo(self.$element.find('div.oe_mail_comments'));
$('<div class="oe_mail_comment">').html(render_res).appendTo(self.$element.find('div.oe_mail_msg'));
});
// this.timeout = setTimeout(this.proxy('fetch_messages'), 5000);
},
do_follow: function () {
this.$element.find('button.oe_mail_action_unfollow').show();
this.$element.find('button.oe_mail_action_follow').hide();
this.$element.find('button.oe_mail_button_unfollow').show();
this.$element.find('button.oe_mail_button_follow').hide();
return this.ds_sub.create({'res_model': this.view.model, 'user_id': this.session.uid, 'res_id': this.view.datarecord.id}).then();
},
do_unfollow: function () {
this.$element.find('button.oe_mail_action_follow').show();
this.$element.find('button.oe_mail_action_unfollow').hide();
this.$element.find('button.oe_mail_button_follow').show();
this.$element.find('button.oe_mail_button_unfollow').hide();
return this.ds.call('message_unsubscribe', [[this.view.datarecord.id]]).then();
},

View File

@ -3,17 +3,28 @@
<div t-name="ThreadView" class="oe_mail_main">
<div class="separator horizontal">OpenSocial</div>
<div class="oe_mail_actions">
<button type="button" class="oe_mail_action_follow">Follow</button>
<button type="button" class="oe_mail_action_unfollow">Unfollow</button>
<div class="oe_mail_main_left">
<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>
</div>
<div class="oe_mail_post_comment">
<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 class="oe_mail_msg">
<div class="oe_mail_comment">
</div>
</div>
</div>
<div class="oe_mail_post_comment">
<textarea rows="3" cols="15">Type your comment</textarea><br />
<button type="button" class="oe_mail_action_comment">Post comment</button>
</div>
<div class="oe_mail_comments">
<div class="oe_mail_main_right">
<button type="button" class="oe_mail_button_getfollowers">See followers</button>
<button type="button" class="oe_mail_button_hidefollowers">Hide followers</button>
<br />
<div class="oe_mail_followers_vignette" title="Raoul Grobedon"><img src="people.png"/></div>
</div>
</div>
<t t-name="ThreadMsgView">
<div class="oe_mail_msg_image">Image</div>
@ -23,15 +34,15 @@
<span class="oe_mail_msg_author">OpenERP System Notification</span>
</t>
<t t-if="record.type == 'comment'">
<span class="oe_mail_msg_author"><t t-raw="record.user_id[1]"/></span>
<span class="oe_mail_msg_author"><a href="#"><t t-raw="record.user_id[1]"/></a></span>
</t>
<t t-if="record.type == 'email'">
<span class="oe_mail_msg_author"><t t-raw="record.user_id[1]"/></span>
</t>
<t t-if="record.need_action_user_id != false">- <span class="oe_mail_msg_need_action">Need action</span></t>
<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>
<br />
<span class="oe_mail_msg_body"><t t-raw="record.body_text"/></span><br />
<span class="oe_mail_msg_date"><t t-raw="record.date"/></span>
<span class="oe_mail_msg_date"><a href="#"><t t-raw="record.date"/></a></span>
</p>
</div>
</t>