[IMP]mail: follower/partners list on wall posting message form

bzr revid: chm@openerp.com-20121004090902-p4b3t4zvs9frc3ky
This commit is contained in:
Christophe Matthieu 2012-10-04 11:09:02 +02:00
parent 27d3070220
commit c5ac7217a8
4 changed files with 93 additions and 56 deletions

View File

@ -88,28 +88,28 @@
<field name="name">Inbox</field>
<field name="tag">mail.wall</field>
<field name="params" eval="&quot;{'domain': [('is_private','=',True),('notification_ids.partner_id.user_ids', 'in', [uid]),('unread', '=', True)],
'context': {'default_model': 'res.users', 'default_res_id': uid, 'default_is_private':True} }&quot;"/>
'context': {'default_model': 'res.partner', 'default_res_id': uid, 'default_is_private':True} }&quot;"/>
</record>
<record id="action_mail_wall_feeds" model="ir.actions.client">
<field name="name">Wall</field>
<field name="tag">mail.wall</field>
<field name="params" eval="&quot;{'domain': [('is_private','=',False),('notification_ids.partner_id.user_ids', 'in', [uid]),('unread', '=', True)],
'context': {'default_model': 'res.users', 'default_res_id': uid, 'default_is_private':False} }&quot;"/>
'context': {'default_model': 'res.partner', 'default_res_id': uid, 'default_is_private':False} }&quot;"/>
</record>
<record id="action_mail_archives_feeds" model="ir.actions.client">
<field name="name">Archives</field>
<field name="tag">mail.wall</field>
<field name="params" eval="&quot;{'domain': [('notification_ids.partner_id.user_ids', 'in', [uid]),('unread', '=', False)],
'context': {'default_model': 'res.users', 'default_res_id': uid} }&quot;"/>
'context': {'default_model': 'res.partner', 'default_res_id': uid} }&quot;"/>
</record>
<record id="action_mail_sent_feeds" model="ir.actions.client">
<field name="name">Sent</field>
<field name="tag">mail.wall</field>
<field name="params" eval="&quot;{'domain': [('author_id.user_ids', 'in', [uid])],
'context': {'default_model': 'res.users', 'default_res_id': uid} }&quot;"/>
'context': {'default_model': 'res.partner', 'default_res_id': uid} }&quot;"/>
</record>
</data>
</openerp>

View File

@ -173,16 +173,41 @@
clear: both;
}
.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_header .oe_all_follower {
color: blue;
}
.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_header .oe_partner_follower a {
color: red;
}
.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_header .oe_hidden,
.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_header .oe_more_hidden {
display: none;
}
.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_bottom button.post {
float: left;
}
.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_bottom span {
float: right;
}
/* default textarea (oe_mail_compose_textarea), and body textarea for compose form view */
.openerp .oe_mail_msg_content textarea.oe_mail_compose_textarea,
.openerp .oe_mail_msg_content div.oe_mail_compose_message_body textarea {
.openerp .oe_mail.oe_semantic_html_override .oe_mail_compose_textarea textarea,
.openerp .oe_mail div.oe_mail_compose_message_body textarea {
width: 474px;
height: 60px;
min-height: 120px;
height: auto;
padding: 4px;
font-size: 12px;
border: 1px solid #cccccc;
}
/* not top textarea */
.openerp .oe_mail.oe_semantic_html_override .oe_semantic_html_override .oe_mail_compose_textarea textarea {
height: 60px;
}
/* default textarea (oe_mail_compose_textarea), and body textarea for compose form view */
.openerp .oe_mail_msg_content textarea.oe_mail_compose_textarea:focus,
.openerp .oe_mail_msg_content div.oe_mail_compose_message_body textarea:focus {
@ -413,11 +438,6 @@
}
/* Dropdown menu */
/*.openerp .oe_mail_msg_content .oe_dropdown_toggle {
position: absolute;
top: 0px;
right: 3px;
}*/
.openerp .oe_mail .oe_semantic_html_override {
position: relative;

View File

@ -336,13 +336,40 @@ openerp.mail = function(session) {
*/
init: function(parent, options) {
this._super(parent);
// record parameters
var param = options.parameters;
for(var i in param){
this[i] = param[i];
}
this.id = param.id || -1;
this.model = param.model || false;
this.parent_id= param.parent_id || false;
this.res_id = param.res_id || false;
this.type = param.type || false;
this.is_author = param.is_author || false;
this.subject = param.subject || false;
this.name = param.name || false;
this.record_name = param.record_name || false;
this.body = param.body || false;
this.vote_user_ids =param.vote_user_ids || [];
this.has_voted = param.has_voted || false;
this.vote_user_ids = param.vote_user_ids || [];
this.unread = param.unread || false;
this._date = param.date;
this.author_id = param.author_id || [];
this.attachment_ids = param.attachment_ids || [];
// record domain and context
this.domain = options.domain || [];
this.context = _.extend({
default_model: 'mail.thread',
default_res_id: 0,
default_parent_id: false }, options.context || {});
// options
// record options
this.options={
'thread' : options.options.thread,
'message' : {
@ -356,31 +383,9 @@ openerp.mail = function(session) {
'truncate_limit': options.options.message.truncate_limit || 250,
}
};
// record options and data
this.parent_thread= parent.messages!= undefined ? parent : options.options.thread._parents[0] ;
var param = options.parameters;
// record parameters
this.id = param.id || -1;
this.model = param.model || false;
this.parent_id= param.parent_id || false;
this.res_id = param.res_id || false;
this.type = param.type || false;
this.is_author = param.is_author || false;
this.subject = param.subject || false;
this.name = param.name || false;
this.record_name = param.record_name || false;
this.body = param.body || false;
this.vote_user_ids =param.vote_user_ids || [];
this.has_voted = param.has_voted || false;
this.vote_user_ids = param.vote_user_ids || [];
this.unread = param.unread || false;
this._date = param.date;
this.author_id = param.author_id || [];
this.attachment_ids = param.attachment_ids || [];
this.parent_thread= parent.messages!= undefined ? parent : options.options.thread._parents[0];
this.thread = false;
if( param.id > 0 ) {
@ -468,6 +473,7 @@ openerp.mail = function(session) {
if(this.thread){
return false;
}
var param = _.extend(self, {'parent_id': self.id});
/*create thread*/
self.thread = new mail.Thread(self, {
'domain': self.domain,
@ -480,11 +486,7 @@ openerp.mail = function(session) {
'thread' : self.options.thread,
'message' : self.options.message
},
'parameters':{
'model': self.model,
'id': self.id,
'parent_id': self.id
}
'parameters': param
}
);
/*insert thread in parent message*/
@ -520,7 +522,7 @@ openerp.mail = function(session) {
*/
on_message_read_unread: function (event) {
event.stopPropagation();
this.animated_destroy({fadeTime:250});
if($(event.srcElement).hasClass("oe_read")) this.animated_destroy({fadeTime:250});
// if this message is read, all childs message display is read
var ids = [this.id].concat( this.get_child_ids() );
this.ds_notification.call('set_message_read', [ids,$(event.srcElement).hasClass("oe_read")]);
@ -667,6 +669,13 @@ openerp.mail = function(session) {
this.id= param.id || false;
this.model= param.model || false;
this.parent_id= param.parent_id || false;
this.is_private = param.is_private || false;
this.partner_ids = [];
for(var i in param.partner_ids){
if(param.partner_ids[i][0]!=(param.author_id ? param.author_id[0] : -1)){
this.partner_ids.push(param.partner_ids[i]);
}
}
this.messages = [];
@ -720,17 +729,9 @@ openerp.mail = function(session) {
* in the function. */
bind_events: function() {
var self = this;
// event: writing in basic textarea of composition form (quick reply)
// event: onblur for hide 'Reply'
this.$('.oe_mail_compose_textarea:first textarea')
.keyup(function (event) {
var charCode = (event.which) ? event.which : window.event.keyCode;
if (event.shiftKey && charCode == 13) { this.value = this.value+"\n"; }
else if (charCode == 13) { return self.message_post(); }
})
.blur(function (event) {
$(this).parents('.oe_mail_thread_action:first').hide();
});
self.$('.oe_mail_compose_textarea:first button.post').click(function () {return self.message_post();});
self.$('.oe_mail_compose_textarea .oe_more').click(function () { var p=$(this).parent(); p.find('.oe_more_hidden, .oe_hidden').show(); p.find('.oe_more').hide(); });
self.$('.oe_mail_compose_textarea .oe_more_hidden').click(function () { var p=$(this).parent(); p.find('.oe_more_hidden, .oe_hidden').hide(); p.find('.oe_more').show(); });
},
/* get all child message/thread id linked
@ -1037,7 +1038,7 @@ openerp.mail = function(session) {
'options':{
'thread':{
'thread_level': this.options.thread_level,
'show_header_compose': show_header_compose,
'show_header_compose': 0, //show_header_compose,
'use_composer': show_header_compose,
'display_on_flat':true
},
@ -1142,7 +1143,7 @@ openerp.mail = function(session) {
'thread' :{
'thread_level': this.options.thread_level,
'use_composer': true,
'show_header_compose': 1,
'show_header_compose': 0,
},
'message': {
'show_reply': this.options.thread_level > 0,

View File

@ -67,7 +67,23 @@
<div class="oe_mail_msg_content">
<!-- contains the composition form -->
<!-- default content: old basic textarea -->
<div class="oe_mail_post_header">
Post a message to:
<span i-if="!widget.is_private" class="oe_all_follower">All Followers</span>
<t t-if="!widget.is_private and widget.partner_ids.length"> and </t>
<t t-set="inc" t-value="0"/>
<t t-if="widget.partner_ids.length" t-foreach="widget.partner_ids" t-as="partner"><span t-attf-class="oe_partner_follower #{inc>=3?'oe_hidden':''}"><t t-if="inc" t-raw="', '"/><a t-attf-href="#model=res.partner&amp;id=#{partner[0]}"><t t-raw="partner[1]"/></a></span><t t-set="inc" t-value="inc+1"/>
</t>
<t t-if="widget.partner_ids.length>=3">
<span class="oe_more">, <a><t t-raw="widget.partner_ids.length-3"/> others...</a></span>
<a class="oe_more_hidden">&lt;&lt;&lt;</a>
</t>
</div>
<textarea placeholder="Add your comment here..."/>
<div class="oe_mail_post_bottom">
<button class="post">Post</button>
<span><a>Compose a full message</a></span>
</div>
</div>
<div class="oe_clear"/>
</div>