[MERGE] from trunk-openchatter-DOM-chm

bzr revid: chm@openerp.com-20121025134930-iyzz1oate4lbitiy
This commit is contained in:
Christophe Matthieu 2012-10-25 15:49:30 +02:00
commit cb3b50cbef
5 changed files with 155 additions and 97 deletions

View File

@ -1,6 +1,3 @@
.oe_mail_wall_threads{
padding: 16px;
}
/* ------------ MAIL WIDGET --------------- */
.openerp .oe_mail, .openerp .oe_mail *{
@ -9,7 +6,7 @@
.openerp .oe_mail {
display: inline-block;
position: relative;
width: 740px;
width: 720px;
margin: 0px;
}
.openerp .oe_mail .oe_thread{
@ -27,6 +24,7 @@
border-radius: 2px;
margin-bottom: 2px;
min-height: 40px;
border: solid 1px rgba(0,0,0,0.03);
}
.openerp .oe_mail .oe_msg_indented{
background: #FFF;
@ -39,6 +37,9 @@
margin:1px;
border-radius:2px;
}
.openerp .oe_mail .oe_msg .oe_subtle{
color: #B7B7D5;
}
.openerp .oe_mail .oe_msg_indented .oe_msg_center{
margin-left:34px;
}
@ -58,20 +59,11 @@
margin-left: 40px;
}
.openerp .oe_mail .oe_msg .oe_msg_footer{
height: 16px;
padding-left: 4px;
overflow: hidden;
font-size: 11px;
opacity:0.8;
-webkit-transition: opacity 0.2s linear;
}
.openerp .oe_mail .oe_thread:hover .oe_msg_footer{
opacity: 1;
-webkit-transition: opacity 0.2s linear;
}
.openerp .oe_mail .oe_msg.oe_msg_composer .oe_msg_footer{
height: auto;
}
.openerp .oe_mail .oe_msg .oe_msg_content{
display: block;
overflow: hidden;
@ -79,7 +71,7 @@
padding-bottom:1px;
}
.openerp .oe_mail .oe_msg .oe_msg_content .oe_msg_title{
font-size: 16px;
font-size: 13px;
margin-bottom: 0px;
margin-top: 2px;
}
@ -130,10 +122,11 @@
}
.openerp .oe_mail .oe_msg .oe_msg_content textarea{
width: 100%;
height: 100%;
height: 32px;
margin: 0px;
padding: 0px;
resize: vertical;
padding: 4px;
}
.openerp .oe_mail .oe_msg.oe_msg_composer_compact, .openerp .oe_mail .oe_msg.oe_msg_expandable{
@ -228,11 +221,15 @@
border: none;
text-shadow: none;
}
.openerp .oe_mail .oe_attach_label{
color: #7C7BAD;
margin-left: -3px;
}
.openerp .oe_mail .oe_msg_footer .oe_attachment_file .oe_form_binary_file{
display: inline-block;
margin-left: -23px;
height: 24px;
width: 24px;
margin-left: -47px;
height: 28px;
width: 52px;
margin-top: -6px;
}
.openerp .oe_mail .oe_mail_list_recipients{
@ -254,11 +251,82 @@
-webkit-transition: opacity 0.2s linear;
}
/* ---------------- MESSAGES BODY ------------------ */
/* ---------------- FOLLOWERS ------------------ */
.openerp .oe_followers{
position: relative;
display: inline-block;
padding-top: 4px;
width: 120px;
float: right;
}
/* a) THE FOLLOW BUTTON */
.openerp .oe_followers button.oe_follower{
display: block;
text-align: center;
width:100%;
}
.openerp .oe_followers button.oe_follower.oe_following{
background-color: #3465A4;
background-image: -webkit-linear-gradient(top, #729FCF, #3465A4);
color: white;
}
.openerp .oe_followers button.oe_follower .oe_follow,
.openerp .oe_followers button.oe_follower .oe_unfollow,
.openerp .oe_followers button.oe_follower .oe_following{
display: none;
}
/* a.1) when following, show 'following' */
.openerp .oe_followers button.oe_follower.oe_following .oe_following{
display: inline;
}
/* a.2) when following and hovering, show 'unfollow' */
.openerp .oe_followers button.oe_follower.oe_following:hover .oe_following{
display: none;
}
.openerp .oe_followers button.oe_follower.oe_following:hover .oe_unfollow{
display: inline;
}
/* a.3) when not following show 'follow' */
.openerp .oe_followers button.oe_follower.oe_notfollow .oe_follow{
display: inline;
}
.openerp .oe_followers .oe_subtype_list{
margin-bottom: 4px;
}
/* b) THE FOLLOWERS */
.openerp .oe_followers .oe_follower_title{
margin-top: 4px;
}
.openerp .oe_followers .oe_partner {
height: 32px;
overflow: hidden;
}
.openerp .oe_followers .oe_partner img{
width: 32px;
margin-right:4px;
border-radius: 2px;
}
/* ---------------- MESSAGES BODY ------------------ */
.openerp .oe_mail .oe_msg_content .oe_blockquote,
.openerp .oe_mail .oe_msg_content blockquote {
padding: 4px;
border-radius: 2px;
border: solid 1px rgba(124,123,173,0.14);
}
/* ----------- FORM INTEGRATION ------------ */
/* Nothing to do yay! */
/* ----------- INBOX INTEGRATION ----------- */
.openerp .oe_mail_wall .oe_mail{
margin: 16px;
}

View File

@ -296,6 +296,7 @@ openerp.mail = function (session) {
/* stack for don't close the compose form if the user click on a button */
this.$render_expandable.on('focus, mouseup', 'textarea', function () { self.stay_open = false; });
this.$render_expandable.on('mousedown', function () { self.stay_open = true; });
this.$render_expandable.find('textarea').autosize();
}
},
@ -1591,7 +1592,7 @@ openerp.mail = function (session) {
}
);
return this.root.appendTo( this.$('.oe_mail_wall_threads:first') );
return this.root.replace(this.$('.oe_mail-placeholder'));
},
});
@ -1687,13 +1688,13 @@ openerp.mail = function (session) {
}
);
return this.root.appendTo( this.$('.oe_mail_wall_threads:first') );
return this.root.replace(this.$('.oe_mail-placeholder'));
},
bind_events: function () {
var self=this;
this.$("button.oe_write_full:first").click(function () { self.root.thread.ComposeMessage.on_compose_fullmail(); });
this.$("button.oe_write_onwall:first").click(function () { self.root.thread.on_compose_message(); });
this.$(".oe_write_full").click(function(){ self.root.thread.ComposeMessage.on_compose_fullmail(); });
this.$(".oe_write_onwall").click(function(){ self.root.thread.on_compose_message(); });
}
});

View File

@ -24,10 +24,10 @@ openerp_mail_followers = function(session, mail) {
init: function() {
this._super.apply(this, arguments);
this.options.image = this.node.attrs.image || 'image_small';
this.options.title = this.node.attrs.title || 'Followers';
this.options.comment = this.node.attrs.help || false;
this.options.displayed_nb = this.node.attrs.displayed_nb || 10;
this.image = this.node.attrs.image || 'image_small';
this.title = this.node.attrs.title || 'Followers';
this.comment = this.node.attrs.help || false;
this.displayed_nb = this.node.attrs.displayed_nb || 10;
this.ds_model = new session.web.DataSetSearch(this, this.view.model);
this.ds_follow = new session.web.DataSetSearch(this, this.field.relation);
this.ds_users = new session.web.DataSetSearch(this, 'res.users');
@ -61,7 +61,7 @@ openerp_mail_followers = function(session, mail) {
self.do_unfollow();
});
// event: click on a subtype, that (un)subscribe for this subtype
this.$el.on('click', 'ul.oe_subtypes input', self.do_update_subscription);
this.$el.on('click', '.oe_subtype_list input', self.do_update_subscription);
// event: click on 'invite' button, that opens the invite wizard
this.$('.oe_invite').on('click', function (event) {
action = {
@ -119,16 +119,16 @@ openerp_mail_followers = function(session, mail) {
/* Display generic info about follower, for people not having access to res_partner */
display_generic: function () {
var self = this;
var node_user_list = this.$('ul.oe_mail_followers_display').empty();
var node_user_list = this.$('.oe_follower_list').empty();
// format content: Followers (You and 0 other) // Followers (3)
var content = this.options.title;
var content = this.title;
if (this.message_is_follower) {
content += ' (You and ' + (this.get('value').length-1) + ' other)';
}
else {
content += ' (' + this.get('value').length + ')'
}
this.$('div.oe_mail_recthread_followers h4').html(content);
this.$('.oe_follower_title').html(content);
},
/** Display the followers */
@ -137,16 +137,16 @@ openerp_mail_followers = function(session, mail) {
records = records || [];
this.message_is_follower = this.set_is_follower(records);
// clean and display title
var node_user_list = this.$('ul.oe_mail_followers_display').empty();
this.$('div.oe_mail_recthread_followers h4').html(this.options.title + ' (' + records.length + ')');
var node_user_list = this.$('.oe_follower_list').empty();
this.$('.oe_follower_title').html(this.title + ' (' + records.length + ')');
// truncate number of displayed followers
truncated = records.splice(0, this.options.displayed_nb);
truncated = records.splice(0, this.displayed_nb);
_(truncated).each(function (record) {
record.avatar_url = mail.ChatterUtils.get_image(self.session, 'res.partner', 'image_small', record.id);
$(session.web.qweb.render('mail.followers.partner', {'record': record})).appendTo(node_user_list);
});
if (truncated.length < records.length) {
$('<li>And ' + (records.length - truncated.length) + ' more.</li>').appendTo(node_user_list);
if (truncated.length < records.length) { //FIXME USE A TEMPLATE !
$('<div class="oe_partner">And ' + (records.length - truncated.length) + ' more.</div>').appendTo(node_user_list);
}
},
@ -172,7 +172,7 @@ openerp_mail_followers = function(session, mail) {
/** Fetch subtypes, only if current user is follower */
fetch_subtypes: function () {
var subtype_list_ul = this.$('.oe_subtypes').empty();
var subtype_list_ul = this.$('.oe_subtype_list').empty();
if (! this.message_is_follower) return;
var context = new session.web.CompoundContext(this.build_context(), {});
this.ds_model.call('message_get_subscription_data', [[this.view.datarecord.id], context]).pipe(this.proxy('display_subtypes'));
@ -181,12 +181,12 @@ openerp_mail_followers = function(session, mail) {
/** Display subtypes: {'name': default, followed} */
display_subtypes:function (data) {
var self = this;
var subtype_list_ul = this.$('.oe_subtypes');
var subtype_list_ul = this.$('.oe_subtype_list');
var records = data[this.view.datarecord.id || this.view.dataset.ids[0]].message_subtype_data;
_(records).each(function (record, record_name) {
record.name = record_name;
record.followed = record.followed || undefined;
$(session.web.qweb.render('mail.followers.subtype', {'record': record})).appendTo( self.$('ul.oe_subtypes') );
$(session.web.qweb.render('mail.followers.subtype', {'record': record})).appendTo( self.$('.oe_subtype_list') );
});
},
@ -209,7 +209,7 @@ openerp_mail_followers = function(session, mail) {
var self = this;
var checklist = new Array();
_(this.$('.oe_mail_recthread_actions input[type="checkbox"]')).each(function (record) {
_(this.$('.oe_actions input[type="checkbox"]')).each(function (record) {
if ($(record).is(':checked')) {
checklist.push(parseInt($(record).data('id')));
}

View File

@ -22,9 +22,10 @@
<div class="oe_msg_center">
<div class="oe_msg_content">
<t t-call="mail.thread.list_recipients"/>
<textarea class="field_text" placeholder=""/>
</div><div class="oe_msg_footer">
<div class="oe_msg_attachment_list"/>
<textarea class="field_text"></textarea>
</div>
<div class="oe_msg_footer">
<div class="oe_msg_attachment_list"></div>
<button class="oe_post">Post</button>
<t t-call="mail.compose_message.add_attachment"/>
<!--<a class="oe_cancel oe_e">X</a>-->
@ -53,7 +54,8 @@
<span class="oe_attachment_file">
<span class="oe_add">
<!-- uploader of file -->
<button class="oe_attach"><span class="oe_e">'</span></button>
<button class="oe_attach"><span class="oe_e">'</span></button>
<span class='oe_attach_label'>File</span>
<t t-call="HiddenInputFile">
<t t-set="fileupload_id" t-value="widget.fileupload_id"/>
<t t-set="fileupload_action">/web/binary/upload_attachment</t>
@ -154,19 +156,15 @@
<button type="button" class="oe_write_full oe_highlight">
Compose a new message
</button>
or
<button type="button" class="oe_write_onwall" help="Your followers can read this message">
Write to your followers
</button>
<span class='oe_alternative'>
or
<a href='#' class='oe_write_onwall oe_bold' help='Your followers can read this message'>Write to your followers</a>
</span>
</td>
</tr>
</tbody>
</table>
<!-- placeholder for the wall threads -->
<div class="oe_mail_wall_threads"/>
<div class="oe_mail_wall_aside">
<!-- contains currently nothing -->
</div>
<div class="oe_mail-placeholder"></div>
</div>
<!--
@ -181,12 +179,10 @@
Template used to display the communication history in documents
form view.
-->
<div t-name="mail.record_thread" class="oe_mail_record_wall">
<!-- <h4>History and Comments</h4> -->
<div class="oe_mail_wall_threads">
<!-- contains the document thread -->
<span t-name="mail.record_thread" class="oe_record_thread">
<div class="oe_mail-placeholder">
</div>
</div>
</span>
<t t-name="mail.thread">
<div t-attf-class="oe_thread #{widget.root?'oe_root_thread':''}"/>
@ -225,12 +221,14 @@
</t>
</div>
<div class="oe_msg_footer">
from <a t-if="widget.author_id" t-attf-href="#model=res.partner&amp;id=#{widget.author_id[0]}"><t t-raw="widget.author_id[1]"/></a>
<a t-if="widget.author_id" t-attf-href="#model=res.partner&amp;id=#{widget.author_id[0]}"><t t-raw="widget.author_id[1]"/></a>
<span class='oe_subtle'></span>
<span t-att-title="widget.date"><t t-raw="widget.timerelative"/></span>
<a t-if="widget.attachment_ids.length > 0" class="oe_mail_msg_view_attachments">
<t t-if="widget.attachment_ids.length == 1">1 Attachment</t>
<t t-if="widget.attachment_ids.length > 1"><t t-raw="widget.attachment_ids.length"/> Attachments</t>
</a>
<span class='oe_subtle'></span>
<t t-call="mail.thread.message.vote"/>
</div>
</div>
@ -261,27 +259,24 @@
Template used to display Like/Unlike in a mail.message
-->
<span t-name="mail.thread.message.vote">
<!--
<span class="oe_left oe_mail_vote_count">
<span class="oe_mail_vote_count">
<t t-if='widget.has_voted'>
You
</t>
<t t-if='(widget.vote_nb - (widget.has_voted ? 1 : 0)) > 0'>
<t t-if='widget.has_voted'> and </t>
<t t-raw="(widget.vote_nb - (widget.has_voted ? 1 : 0))"/>
<t t-esc="widget.vote_nb"/> people
</t>
<t t-if='(widget.vote_nb - (widget.has_voted ? 1 : 0)) > 0'>
<t t-raw="(widget.vote_nb - (widget.has_voted ? 1 : 0))"/>
concur
<t t-if='widget.vote_nb'>
like
</t>
</span>
<button t-attf-class="oe_msg_vote oe_tag">
<span>
<t t-if="!widget.has_voted">Concur</t>
<t t-if="widget.has_voted">Respectfully disagree</t>
</span>
</button>
-->
<a href='#' t-attf-class="oe_msg_vote">
<t t-if="!widget.has_voted">like</t>
<t t-if="widget.has_voted">unlike</t>
</a>
</span>
<!-- mail.thread.message.star

View File

@ -5,51 +5,45 @@
followers main template
Template used to display the followers, the actions and the subtypes in a record.
-->
<div t-name="mail.followers" class="oe_mail_recthread_aside oe_semantic_html_override">
<div class="oe_mail_recthread_actions">
<div class="oe_mail_subtypes">
<button type="button" class="oe_follower oe_notfollow">
<span class="oe_follow">Follow</span>
<span class="oe_unfollow">Unfollow</span>
<span class="oe_following">Following</span>
</button>
</div>
<div class="oe_recthread_subtypes">
<ul class="oe_subtypes"></ul>
</div>
<div t-name="mail.followers" class="oe_followers">
<div class="oe_actions">
<button type="button" class="oe_follower oe_notfollow">
<span class="oe_follow">Follow</span>
<span class="oe_unfollow">Unfollow</span>
<span class="oe_following">Following</span>
</button>
<div class="oe_subtype_list"></div>
</div>
<t t-if="widget.options.comment">
<h5 class="oe_grey"><t t-raw="widget.options.comment"/></h5>
<t t-if="widget.comment">
<h5 class="oe_comment"><t t-raw="widget.comment"/></h5>
</t>
<div class="oe_mail_recthread_followers">
<button type="button" class="oe_invite"><span>Invite</span></button>
<t t-if="widget.options.title">
<h4><t t-raw="widget.options.title"/></h4>
</t>
<ul class="oe_mail_followers_display"></ul>
</div>
<button type="button" class="oe_invite"><span>Invite</span></button>
<t t-if="widget.title">
<h4 class='oe_follower_title'><t t-raw="widget.title"/></h4>
</t>
<div class="oe_follower_list"></div>
</div>
<!--
followers.partner template
Template used to display a partner following the record
-->
<li t-name="mail.followers.partner">
<div t-name="mail.followers.partner" class='oe_partner'>
<img class="oe_mail_thumbnail oe_mail_frame" t-attf-src="{record.avatar_url}"/>
<a t-attf-href="#model=res.partner&amp;id=#{record.id}"><t t-raw="record.name"/></a>
</li>\
</div>
<!--
followers.subtype template
Template used to display message subtypes of a follower subscription
-->
<li t-name="mail.followers.subtype">
<table width="50%">
<t t-name="mail.followers.subtype">
<table class='oe_subtype'>
<tr>
<td><label t-att-for="'input_mail_followers_subtype_'+record.id"><t t-raw="record.name"/></label></td>
<td width="10%"><input type="checkbox" t-att-checked="record.followed" t-att-id="'input_mail_followers_subtype_'+record.id" t-att-data-id="record.id" t-att-name="record.name" class="oe_msg_subtype_check"/></td>
</tr>
</table>
</li>
</t>
</template>