[IMP] mail: followers css + widget integration in inbox and formview
bzr revid: fva@openerp.com-20121024152043-q5j7hpa4rur39k03
This commit is contained in:
parent
7a507ea93e
commit
8d9fdcc352
|
@ -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;
|
||||
|
@ -58,7 +56,6 @@
|
|||
margin-left: 40px;
|
||||
}
|
||||
.openerp .oe_mail .oe_msg .oe_msg_footer{
|
||||
height: 16px;
|
||||
padding-left: 4px;
|
||||
overflow: hidden;
|
||||
font-size: 11px;
|
||||
|
@ -69,9 +66,6 @@
|
|||
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;
|
||||
|
@ -248,3 +242,75 @@
|
|||
opacity: 1;
|
||||
-webkit-transition: opacity 0.2s linear;
|
||||
}
|
||||
|
||||
/* ---------------- 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;
|
||||
}
|
||||
|
||||
/* ----------- FORM INTEGRATION ------------ */
|
||||
|
||||
/* Nothing to do yay! */
|
||||
|
||||
/* ----------- INBOX INTEGRATION ----------- */
|
||||
|
||||
.openerp .oe_mail_wall .oe_mail{
|
||||
margin: 16px;
|
||||
}
|
||||
|
|
|
@ -1560,7 +1560,7 @@ openerp.mail = function(session) {
|
|||
}
|
||||
);
|
||||
|
||||
return this.root.appendTo( this.$('.oe_mail_wall_threads:first') );
|
||||
return this.root.replace(this.$('.oe_mail-placeholder'));
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -1658,7 +1658,7 @@ 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(){
|
||||
|
|
|
@ -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')));
|
||||
}
|
||||
|
|
|
@ -153,11 +153,7 @@
|
|||
</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>
|
||||
|
||||
<!--
|
||||
|
@ -172,12 +168,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':''}"/>
|
||||
|
|
|
@ -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&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>
|
||||
|
|
Loading…
Reference in New Issue