[IMP] mail: prepare js for dom
bzr revid: chm@openerp.com-20121017001320-wmxtng544wc3whd3
This commit is contained in:
parent
5cbe3e5d31
commit
e8bd522f6b
|
@ -262,7 +262,6 @@ class mail_message(osv.Model):
|
|||
"""
|
||||
# sort for group items
|
||||
tree = sorted(tree, key=lambda k: k['id'])
|
||||
|
||||
tree_not = []
|
||||
# expandable for not show message
|
||||
for msg in tree:
|
||||
|
@ -367,7 +366,7 @@ class mail_message(osv.Model):
|
|||
ids = self.search(cr, uid, domain, context=context, limit=limit)
|
||||
for msg in self.browse(cr, uid, ids, context=context):
|
||||
# if not in tree and not in message_loded list
|
||||
if msg.id not in message_ids and msg.id not in message_loaded_ids :
|
||||
if msg.id not in message_ids and msg not in tree and msg.id not in message_loaded_ids :
|
||||
message_ids.append(msg.id)
|
||||
tree.append(msg)
|
||||
|
||||
|
@ -381,7 +380,7 @@ class mail_message(osv.Model):
|
|||
# get all parented message if the user have the access
|
||||
while parent and parent.id != parent_id:
|
||||
parent_id = msg.parent_id.id
|
||||
if msg.parent_id not in tree and parent_id not in message_loaded_ids:
|
||||
if parent not in tree and parent_id not in message_loaded_ids:
|
||||
tree.append(parent)
|
||||
# if not in tree and not in message_loded list
|
||||
if parent.id not in message_ids and parent.id not in message_loaded_ids :
|
||||
|
|
|
@ -54,13 +54,13 @@
|
|||
/* Specific display of threads in the wall */
|
||||
/* ------------------------------------------------------------ */
|
||||
|
||||
.openerp ul.oe_mail_wall_threads .oe_mail_msg_content textarea.oe_mail_compose_textarea {
|
||||
.openerp ul.oe_mail_wall_threads .oe_msg_content textarea.oe_mail_compose_textarea {
|
||||
width: 434px;
|
||||
height: 30px;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.openerp li.oe_mail_wall_thread:first .oe_mail_msg_notification {
|
||||
.openerp li.oe_mail_wall_thread:first .oe_msg_notification {
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@
|
|||
height: 28px;
|
||||
}
|
||||
|
||||
.openerp div.oe_thread_placeholder div.oe_mail_msg_content {
|
||||
.openerp div.oe_thread_placeholder div.oe_msg_content {
|
||||
width: 440px;
|
||||
}
|
||||
|
||||
|
@ -181,8 +181,8 @@
|
|||
}
|
||||
|
||||
/* 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 {
|
||||
.openerp .oe_msg_content textarea.oe_mail_compose_textarea:focus,
|
||||
.openerp .oe_msg_content div.oe_mail_compose_message_body textarea:focus {
|
||||
outline: 0;
|
||||
border-color: rgba(82, 168, 236, 0.8);
|
||||
-moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 8px rgba(82, 168, 236, 0.6);
|
||||
|
@ -191,7 +191,7 @@
|
|||
}
|
||||
|
||||
.openerp .oe_mail_vote_count,
|
||||
.openerp .oe_mail_msg_vote{
|
||||
.openerp .oe_msg_vote{
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
|
@ -254,35 +254,35 @@
|
|||
margin: 0 0 4px 0;
|
||||
}
|
||||
|
||||
.openerp .oe_mail_msg_notification,
|
||||
.openerp .oe_mail_msg_expandable,
|
||||
.openerp .oe_mail_msg_comment,
|
||||
.openerp .oe_mail_msg_email {
|
||||
.openerp .oe_msg_notification,
|
||||
.openerp .oe_msg_expandable,
|
||||
.openerp .oe_msg_comment,
|
||||
.openerp .oe_msg_email {
|
||||
padding: 8px;
|
||||
background: white;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.openerp .oe_mail_msg_notification:after,
|
||||
.openerp .oe_mail_msg_comment:after,
|
||||
.openerp .oe_mail_msg_email:after {
|
||||
.openerp .oe_msg_notification:after,
|
||||
.openerp .oe_msg_comment:after,
|
||||
.openerp .oe_msg_email:after {
|
||||
content: "";
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.openerp div.oe_mail_msg_content {
|
||||
.openerp div.oe_msg_content {
|
||||
float: left;
|
||||
position: relative;
|
||||
width: 486px;
|
||||
}
|
||||
|
||||
.openerp div.oe_mail_msg_content > li {
|
||||
.openerp div.oe_msg_content > li {
|
||||
float: left;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
.openerp .oe_mail_msg_content:after {
|
||||
.openerp .oe_msg_content:after {
|
||||
content: "";
|
||||
display: block;
|
||||
clear: both;
|
||||
|
@ -326,23 +326,23 @@
|
|||
/* Messages layout
|
||||
/* ------------------------------------------------------------ */
|
||||
|
||||
.openerp .oe_mail_msg .oe_mail_msg_title {
|
||||
.openerp .oe_mail_msg .oe_msg_title {
|
||||
margin: 0;
|
||||
font-size: 1.3em;
|
||||
font-weight: bold;
|
||||
}
|
||||
.openerp .oe_mail_msg .oe_mail_msg_title a:link,
|
||||
.openerp .oe_mail_msg .oe_mail_msg_title a:visited {
|
||||
.openerp .oe_mail_msg .oe_msg_title a:link,
|
||||
.openerp .oe_mail_msg .oe_msg_title a:visited {
|
||||
color: #4C4C4C;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.openerp .oe_mail_msg .oe_mail_msg_body {
|
||||
.openerp .oe_mail_msg .oe_msg_body {
|
||||
margin-bottom: .5em;
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
.openerp .oe_mail_msg .oe_mail_msg_body pre {
|
||||
.openerp .oe_mail_msg .oe_msg_body pre {
|
||||
font-family: "Lucida Grande", Helvetica, Verdana, Arial, sans-serif;
|
||||
margin: 0px;
|
||||
white-space: pre-wrap;
|
||||
|
@ -380,31 +380,31 @@
|
|||
}
|
||||
|
||||
/* Message footer */
|
||||
.openerp .oe_mail_msg .oe_mail_msg_footer {
|
||||
.openerp .oe_mail_msg .oe_msg_footer {
|
||||
color: #888;
|
||||
}
|
||||
.openerp .oe_mail_msg .oe_mail_msg_footer li {
|
||||
.openerp .oe_mail_msg .oe_msg_footer li {
|
||||
float: left;
|
||||
margin-right: 3px;
|
||||
}
|
||||
.openerp .oe_mail_msg .oe_mail_msg_footer li:after {
|
||||
.openerp .oe_mail_msg .oe_msg_footer li:after {
|
||||
content: " · ";
|
||||
}
|
||||
.openerp .oe_mail_msg .oe_mail_msg_footer li:last-child:after {
|
||||
.openerp .oe_mail_msg .oe_msg_footer li:last-child:after {
|
||||
content: "";
|
||||
}
|
||||
|
||||
/* Attachments list */
|
||||
.openerp .oe_mail_msg_content ul.oe_mail_msg_attachments {
|
||||
.openerp .oe_msg_content ul.oe_msg_attachments {
|
||||
width: 100%;
|
||||
margin: .5em 0 0 0;
|
||||
padding: .5em 0;
|
||||
list-style-position: inside;
|
||||
}
|
||||
.openerp .oe_mail_msg_content ul.oe_mail_msg_attachments.oe_hidden {
|
||||
.openerp .oe_msg_content ul.oe_msg_attachments.oe_hidden {
|
||||
display: none;
|
||||
}
|
||||
.openerp .oe_mail_msg_content ul.oe_mail_msg_attachments li {
|
||||
.openerp .oe_msg_content ul.oe_msg_attachments li {
|
||||
float: none;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
|
@ -412,19 +412,19 @@
|
|||
padding: 0;
|
||||
list-style-type: square;
|
||||
}
|
||||
.openerp .oe_mail_msg_content ul.oe_mail_msg_attachments .oe_upload_in_process {
|
||||
.openerp .oe_msg_content ul.oe_msg_attachments .oe_upload_in_process {
|
||||
float: right;
|
||||
width: 200px;
|
||||
height: 16px;
|
||||
}
|
||||
.openerp .oe_mail_msg_content ul.oe_mail_msg_attachments .oe_upload_in_process div {
|
||||
.openerp .oe_msg_content ul.oe_msg_attachments .oe_upload_in_process div {
|
||||
float: left;
|
||||
width: 38px;
|
||||
height: 16px;
|
||||
margin-right: 2px;
|
||||
background: #66FF66;
|
||||
}
|
||||
.openerp .oe_mail_msg_content ul.oe_mail_msg_attachments .oe_upload_in_process span {
|
||||
.openerp .oe_msg_content ul.oe_msg_attachments .oe_upload_in_process span {
|
||||
color: #aaaaaa;
|
||||
position: absolute;
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
/* Compose Message */
|
||||
/* ------------------------------ */
|
||||
|
||||
.openerp .oe_mail_msg_content .oe_mail_compose_message_footer {
|
||||
.openerp .oe_msg_content .oe_mail_compose_message_footer {
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.openerp .oe_mail_msg_content .oe_mail_compose_message_footer button.oe_mail_compose_message_button_send {
|
||||
.openerp .oe_msg_content .oe_mail_compose_message_footer button.oe_mail_compose_message_button_send {
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@
|
|||
font-size: 30px;
|
||||
}
|
||||
|
||||
.openerp .oe_mail .oe_mail_msg_attachments input {
|
||||
.openerp .oe_mail .oe_msg_attachments input {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
|
@ -128,39 +128,39 @@
|
|||
}
|
||||
|
||||
/* form_view: delete white background */
|
||||
.openerp .oe_mail_msg_content div.oe_formview {
|
||||
.openerp .oe_msg_content div.oe_formview {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.openerp .oe_mail_msg_content div.oe_form_nosheet {
|
||||
.openerp .oe_msg_content div.oe_form_nosheet {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.openerp .oe_mail_msg_content table.oe_form_group {
|
||||
.openerp .oe_msg_content table.oe_form_group {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.openerp .oe_mail_msg_content table.oe_form_field,
|
||||
.openerp .oe_mail_msg_content div.oe_form_field {
|
||||
.openerp .oe_msg_content table.oe_form_field,
|
||||
.openerp .oe_msg_content div.oe_form_field {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.openerp .oe_mail_msg_content td.oe_form_group_cell {
|
||||
.openerp .oe_msg_content td.oe_form_group_cell {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
/* subject: change width */
|
||||
.openerp .oe_mail_msg_content .oe_form .oe_form_field input[type='text'] {
|
||||
.openerp .oe_msg_content .oe_form .oe_form_field input[type='text'] {
|
||||
width: 472px;
|
||||
}
|
||||
|
||||
/* body_html: cleditor */
|
||||
.openerp .oe_mail_msg_content div.cleditorMain {
|
||||
.openerp .oe_msg_content div.cleditorMain {
|
||||
border: 1px solid #cccccc;
|
||||
}
|
||||
|
||||
/* destination_partner_ids */
|
||||
.openerp .oe_mail_msg_content div.text-core {
|
||||
.openerp .oe_msg_content div.text-core {
|
||||
height: 22px !important;
|
||||
width: 472px;
|
||||
}
|
|
@ -42,8 +42,6 @@ openerp.mail = function(session) {
|
|||
};
|
||||
/* end hack */
|
||||
|
||||
$('.openerp .oe_mail_wall_threads .oe_mail_thread button.oe_mail_wall_button_fetch').click();
|
||||
|
||||
}
|
||||
return this._super(action, on_close);
|
||||
},
|
||||
|
@ -168,7 +166,7 @@ openerp.mail = function(session) {
|
|||
} else {
|
||||
this.list_attachment.replaceWith( render );
|
||||
}
|
||||
this.list_attachment = this.$("ul.oe_mail_msg_attachments");
|
||||
this.list_attachment = this.$("ul.oe_msg_attachments");
|
||||
|
||||
// event: delete an attachment
|
||||
this.$el.on('click', '.oe_mail_attachment_delete', self.on_attachment_delete);
|
||||
|
@ -386,12 +384,13 @@ openerp.mail = function(session) {
|
|||
default_parent_id: false }, options.context || {});
|
||||
|
||||
this.datasets = {
|
||||
'id' : options.parameters.id || -1,
|
||||
'model' : options.parameters.model || false,
|
||||
'parent_id' : options.parameters.parent_id || false,
|
||||
'nb_messages' : options.parameters.nb_messages || 0,
|
||||
'id' : options.datasets.id || -1,
|
||||
'model' : options.datasets.model || false,
|
||||
'parent_id' : options.datasets.parent_id || false,
|
||||
'nb_messages' : options.datasets.nb_messages || 0,
|
||||
'type' : 'expandable',
|
||||
'max_limit' : options.parameters.max_limit || false,
|
||||
'max_limit' : options.datasets.max_limit || false,
|
||||
'flag_used' : false,
|
||||
};
|
||||
|
||||
// record options and data
|
||||
|
@ -412,17 +411,30 @@ openerp.mail = function(session) {
|
|||
this.$el.on('click', 'a.oe_mail_fetch_more', self.on_expandable);
|
||||
},
|
||||
|
||||
animated_destroy: function(options) {
|
||||
var self=this;
|
||||
//graphic effects
|
||||
if(options && options.fadeTime) {
|
||||
self.$el.fadeOut(options.fadeTime, function(){
|
||||
self.destroy();
|
||||
});
|
||||
} else {
|
||||
self.destroy();
|
||||
}
|
||||
},
|
||||
|
||||
/*The selected thread and all childs (messages/thread) became read
|
||||
* @param {object} mouse envent
|
||||
*/
|
||||
on_expandable: function (event) {
|
||||
if(event)event.stopPropagation();
|
||||
var self = this;
|
||||
if(this.datasets.flag_used) {
|
||||
return false
|
||||
}
|
||||
this.datasets.flag_used = true;
|
||||
|
||||
this.animated_destroy({'fadeTime':300});
|
||||
this.parent_thread.message_fetch(false, this.domain, this.context);
|
||||
this.$el.fadeOut(300, function(){
|
||||
self.destroy();
|
||||
});
|
||||
this.$('*').unbind();
|
||||
return false;
|
||||
},
|
||||
});
|
||||
|
@ -473,11 +485,8 @@ 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];
|
||||
}
|
||||
// record datasets
|
||||
var param = options.datasets;
|
||||
this.datasets = _.extend({
|
||||
'id' : -1,
|
||||
'model' : false,
|
||||
|
@ -533,7 +542,7 @@ openerp.mail = function(session) {
|
|||
this.parent_thread= parent.messages!= undefined ? parent : options.options.thread._parents[0];
|
||||
this.thread = false;
|
||||
|
||||
if( param.id > 0 ) {
|
||||
if( this.datasets.id > 0 ) {
|
||||
this.formating_data();
|
||||
}
|
||||
|
||||
|
@ -573,20 +582,20 @@ openerp.mail = function(session) {
|
|||
var self = this;
|
||||
|
||||
// event: click on 'Attachment(s)' in msg
|
||||
this.$('a.oe_mail_msg_view_attachments:first').on('click', function (event) {
|
||||
self.$('.oe_mail_msg_attachments:first').toggle();
|
||||
this.$('a.oe_msg_view_attachments:first').on('click', function (event) {
|
||||
self.$('.oe_msg_attachments:first').toggle();
|
||||
});
|
||||
// event: click on icone 'Read' in header
|
||||
this.$el.on('click', 'a.oe_read', this.on_message_read_unread);
|
||||
// event: click on icone 'UnRead' in header
|
||||
this.$el.on('click', 'a.oe_unread', this.on_message_read_unread);
|
||||
// event: click on 'Delete' in msg side menu
|
||||
this.$el.on('click', 'a.oe_mail_msg_delete', this.on_message_delete);
|
||||
this.$el.on('click', 'a.oe_msg_delete', this.on_message_delete);
|
||||
|
||||
// event: click on 'Reply' in msg
|
||||
this.$el.on('click', 'a.oe_reply', this.on_message_reply);
|
||||
// event: click on 'Vote' button
|
||||
this.$el.on('click', 'button.oe_mail_msg_vote', this.on_vote);
|
||||
this.$el.on('click', 'button.oe_msg_vote', this.on_vote);
|
||||
// event: click on 'Star' button
|
||||
this.$el.on('click', 'button.oe_mail_starbox', this.on_star);
|
||||
},
|
||||
|
@ -598,11 +607,11 @@ openerp.mail = function(session) {
|
|||
},
|
||||
|
||||
expender: function(){
|
||||
this.$('div.oe_mail_msg_body:first').expander({
|
||||
this.$('div.oe_msg_body:first').expander({
|
||||
slicePoint: this.options.truncate_limit,
|
||||
expandText: 'read more',
|
||||
userCollapseText: '[^]',
|
||||
detailClass: 'oe_mail_msg_tail',
|
||||
detailClass: 'oe_msg_tail',
|
||||
moreClass: 'oe_mail_expand',
|
||||
lessClass: 'oe_mail_reduce',
|
||||
});
|
||||
|
@ -613,7 +622,7 @@ openerp.mail = function(session) {
|
|||
if(this.thread){
|
||||
return false;
|
||||
}
|
||||
var param = _.extend(self, {'parent_id': self.datasets.id});
|
||||
|
||||
/*create thread*/
|
||||
self.thread = new mail.Thread(self, {
|
||||
'domain': self.domain,
|
||||
|
@ -626,7 +635,7 @@ openerp.mail = function(session) {
|
|||
'thread' : self.options.thread,
|
||||
'message' : self.options.message
|
||||
},
|
||||
'parameters': param
|
||||
'datasets': self.datasets
|
||||
}
|
||||
);
|
||||
/*insert thread in parent message*/
|
||||
|
@ -836,7 +845,7 @@ openerp.mail = function(session) {
|
|||
// record options and data
|
||||
this.parent_message= parent.thread!= undefined ? parent : false ;
|
||||
|
||||
var param = options.parameters
|
||||
var param = options.datasets
|
||||
// datasets and internal vars
|
||||
this.datasets = {
|
||||
'id' : param.id || false,
|
||||
|
@ -844,7 +853,7 @@ openerp.mail = function(session) {
|
|||
'parent_id' : param.parent_id || false,
|
||||
'is_private' : param.is_private || false,
|
||||
'author_id' : param.author_id || false,
|
||||
'thread_level' : param.thread_level+1 || 0,
|
||||
'thread_level' : (param.thread_level+1) || 0,
|
||||
'partner_ids' : []
|
||||
};
|
||||
|
||||
|
@ -855,6 +864,7 @@ openerp.mail = function(session) {
|
|||
}
|
||||
|
||||
this.messages = [];
|
||||
this.ComposeMessage = false;
|
||||
|
||||
this.ds_thread = new session.web.DataSetSearch(this, this.context.default_model || 'mail.thread');
|
||||
this.ds_message = new session.web.DataSetSearch(this, 'mail.message');
|
||||
|
@ -864,13 +874,11 @@ openerp.mail = function(session) {
|
|||
this._super.apply(this, arguments);
|
||||
|
||||
this.list_ul = this.$('ul.oe_mail_thread_display:first');
|
||||
this.more_msg = this.$(">.oe_mail_msg_more_message:first");
|
||||
this.more_msg = this.$(">.oe_msg_more_message:first");
|
||||
|
||||
this.display_user_avatar();
|
||||
var display_done = compose_done = false;
|
||||
|
||||
this.instantiate_ComposeMessage();
|
||||
|
||||
this.bind_events();
|
||||
|
||||
if(this.options.thread._parents[0]==this){
|
||||
|
@ -904,17 +912,14 @@ openerp.mail = function(session) {
|
|||
|
||||
$(session.web.qweb.render('mail.wall_no_message', {})).appendTo(this.$('ul.oe_mail_thread_display'));
|
||||
|
||||
this.instantiate_ComposeMessage();
|
||||
this.ComposeMessage.datasets.is_private=true;
|
||||
|
||||
if(this.options.thread.show_header_compose){
|
||||
this.ComposeMessage.$el.show();
|
||||
//this.ComposeMessage.set_free_attachments();
|
||||
}
|
||||
this.ComposeMessage.datasets.is_private=true;
|
||||
|
||||
var button_fetch = $('<button style="display:none;" class="oe_mail_wall_button_fetch"/>').click(function(event){
|
||||
if(event)event.stopPropagation();
|
||||
self.message_fetch();
|
||||
});
|
||||
this.$el.prepend(button_fetch);
|
||||
this.$el.addClass("oe_mail_root_thread");
|
||||
},
|
||||
|
||||
|
@ -923,19 +928,18 @@ openerp.mail = function(session) {
|
|||
*/
|
||||
on_scroll: function(event){
|
||||
if(event)event.stopPropagation();
|
||||
_(this.messages).each(function(message,key){
|
||||
if(message && message.datasets.type=="expandable" && message.datasets.max_limit){
|
||||
var pos = message.$el.position();
|
||||
if(pos.top){
|
||||
/* bottom of the screen */
|
||||
var bottom = $(window).scrollTop()+$(window).height()+200;
|
||||
if(bottom - pos.top > 0){
|
||||
message.on_expandable();
|
||||
}
|
||||
var message = this.messages[0];
|
||||
if(message && message.datasets.type=="expandable" && message.datasets.max_limit){
|
||||
var pos = message.$el.position();
|
||||
if(pos.top){
|
||||
/* bottom of the screen */
|
||||
var bottom = $(window).scrollTop()+$(window).height()+200;
|
||||
if(bottom - pos.top > 0){
|
||||
message.on_expandable();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1021,6 +1025,9 @@ openerp.mail = function(session) {
|
|||
/* this function is launch when a user click on "Reply" button
|
||||
*/
|
||||
on_compose_message: function(){
|
||||
if(!this.ComposeMessage){
|
||||
this.instantiate_ComposeMessage();
|
||||
}
|
||||
this.ComposeMessage.$el.toggle();
|
||||
return false;
|
||||
},
|
||||
|
@ -1050,51 +1057,51 @@ openerp.mail = function(session) {
|
|||
|
||||
/* create record object and linked him
|
||||
*/
|
||||
create_message_object: function (message) {
|
||||
create_message_object: function (data) {
|
||||
var self = this;
|
||||
|
||||
// check if the message is already create
|
||||
for(var i in this.messages){
|
||||
if(this.messages[i].id==message.id){
|
||||
this.messages[i].destroy();
|
||||
this.messages[i]=self.insert_message(message);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
self.messages.push( self.insert_message(message) );
|
||||
},
|
||||
|
||||
/** Displays a message or an expandable message */
|
||||
insert_message: function (record) {
|
||||
var self=this;
|
||||
|
||||
this.$("li.oe_wall_no_message").remove();
|
||||
|
||||
if(record.type=='expandable'){
|
||||
if(data.type=='expandable'){
|
||||
var message = new mail.ThreadExpandable(self, {
|
||||
'domain': record.domain,
|
||||
'domain': data.domain,
|
||||
'context': {
|
||||
'default_model': record.model || this.context.default_model,
|
||||
'default_res_id': record.res_id || this.context.default_res_id,
|
||||
'default_model': data.model || self.context.default_model,
|
||||
'default_res_id': data.res_id || self.context.default_res_id,
|
||||
'default_parent_id': self.datasets.id },
|
||||
'parameters': record
|
||||
'datasets': data
|
||||
});
|
||||
} else {
|
||||
var message = new mail.ThreadMessage(self, {
|
||||
'domain': record.domain,
|
||||
'domain': data.domain,
|
||||
'context': {
|
||||
'default_model': record.model,
|
||||
'default_res_id': record.res_id,
|
||||
'default_parent_id': record.id },
|
||||
'default_model': data.model,
|
||||
'default_res_id': data.res_id,
|
||||
'default_parent_id': data.id },
|
||||
'options':{
|
||||
'thread': self.options.thread,
|
||||
'message': self.options.message
|
||||
},
|
||||
'parameters': _.extend(record, {'thread_level': this.datasets.thread_level})
|
||||
'datasets': _.extend(data, {'thread_level': self.datasets.thread_level})
|
||||
});
|
||||
var data = _.extend(data, {'thread_level': self.datasets.thread_level});
|
||||
}
|
||||
|
||||
// check if the message is already create
|
||||
for(var i in self.messages){
|
||||
if(self.messages[i].datasets.id==message.datasets.id){
|
||||
self.messages[i].destroy();
|
||||
self.messages[i]=self.insert_message(message);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
self.messages.push( self.insert_message(message) );
|
||||
},
|
||||
|
||||
/** Displays a message or an expandable message */
|
||||
insert_message: function (message) {
|
||||
var self=this;
|
||||
|
||||
this.$("li.oe_wall_no_message").remove();
|
||||
|
||||
// insert on hierarchy display => insert in self child
|
||||
var thread_messages = self.messages;
|
||||
var thread = self;
|
||||
|
@ -1262,7 +1269,7 @@ openerp.mail = function(session) {
|
|||
'show_dd_delete': false
|
||||
}
|
||||
},
|
||||
'parameters': {},
|
||||
'datasets': {},
|
||||
}
|
||||
);
|
||||
return this.thread.appendTo( this.$('.oe_mail_wall_threads:first') );
|
||||
|
@ -1367,7 +1374,7 @@ openerp.mail = function(session) {
|
|||
'show_dd_delete': false,
|
||||
},
|
||||
},
|
||||
'parameters': {},
|
||||
'datasets': {},
|
||||
}
|
||||
);
|
||||
return this.thread.appendTo( this.$('.oe_mail_wall_threads:first') );
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<t t-name="mail.compose_message">
|
||||
<div class="oe_mail_compose_textarea">
|
||||
<img class="oe_mail_icon oe_mail_frame oe_left" alt="User img"/>
|
||||
<div class="oe_mail_msg_content">
|
||||
<div class="oe_msg_content">
|
||||
<!-- contains the composition form -->
|
||||
<!-- default content: old basic textarea -->
|
||||
<div class="oe_mail_post_header">
|
||||
|
@ -55,7 +55,7 @@
|
|||
Template used to display attachments in a mail.message
|
||||
-->
|
||||
<t t-name="mail.thread.message.attachments">
|
||||
<ul t-attf-class="oe_mail_msg_attachments #{widget.datasets.attachment_ids[0] and widget.options.thread.show_attachment_link?'':'oe_hidden'}">
|
||||
<ul t-attf-class="oe_msg_attachments #{widget.datasets.attachment_ids[0] and widget.options.thread.show_attachment_link?'':'oe_hidden'}">
|
||||
<t t-foreach="widget.datasets.attachment_ids" t-as="attachment">
|
||||
<li>
|
||||
<span t-if="(attachment.upload or attachment.percent_loaded<100)" t-attf-title="{(attachment.name || attachment.filename) + (attachment.date?' \n('+attachment.date+')':'' )}" t-attf-name="{attachment.name || attachment.filename}">
|
||||
|
@ -181,7 +181,7 @@
|
|||
|
||||
<!-- default layout -->
|
||||
<li t-name="mail.thread.message" t-attf-class="oe_mail oe_mail_thread_msg #{!widget.datasets.read ? 'oe_mail_undefined_read' : (widget.datasets.read=='read'?'oe_mail_read':'oe_mail_unread')}">
|
||||
<div t-attf-class="oe_mail_msg_#{widget.datasets.type} oe_semantic_html_override">
|
||||
<div t-attf-class="oe_msg_#{widget.datasets.type} oe_semantic_html_override">
|
||||
<!-- message actions (read/unread, reply, delete...) -->
|
||||
<ul class="oe_header">
|
||||
<li class="placeholder-mail-vote"><t t-call="mail.thread.message.vote"/></li>
|
||||
|
@ -194,8 +194,8 @@
|
|||
<span class="oe_dropdown_toggle">
|
||||
<a class="oe_e" title="More options">í</a>
|
||||
<ul class="oe_dropdown_menu">
|
||||
<li t-if="widget.datasets.is_author and widget.options.message.show_dd_delete"><a class="oe_mail_msg_delete">Delete</a></li>
|
||||
<li t-if="widget.datasets.type == 'email'"><a class="oe_mail_msg_details" t-attf-href="#model=mail.message&id=#{widget.datasets.id}" >Details</a></li>
|
||||
<li t-if="widget.datasets.is_author and widget.options.message.show_dd_delete"><a class="oe_msg_delete">Delete</a></li>
|
||||
<li t-if="widget.datasets.type == 'email'"><a class="oe_msg_details" t-attf-href="#model=mail.message&id=#{widget.datasets.id}" >Details</a></li>
|
||||
</ul>
|
||||
</span>
|
||||
</li>
|
||||
|
@ -206,24 +206,24 @@
|
|||
<img class="oe_mail_icon oe_mail_frame oe_left" t-att-src="widget.datasets.avatar"/>
|
||||
</a>
|
||||
|
||||
<div class="oe_mail_msg_content">
|
||||
<div class="oe_msg_content">
|
||||
<!-- message itself -->
|
||||
<div class="oe_mail_msg">
|
||||
<h1 t-if="widget.datasets.subject" class="oe_mail_msg_title">
|
||||
<h1 t-if="widget.datasets.subject" class="oe_msg_title">
|
||||
<t t-raw="widget.datasets.subject"/>
|
||||
</h1>
|
||||
<ul class="oe_mail_msg_footer">
|
||||
<ul class="oe_msg_footer">
|
||||
<li t-if="widget.datasets.author_id"><a t-attf-href="#model=res.partner&id=#{widget.datasets.author_id[0]}"><t t-raw="widget.datasets.author_id[1]"/></a></li>
|
||||
<li><span t-att-title="widget.datasets.date"><t t-raw="widget.datasets.timerelative"/></span></li>
|
||||
<li t-if="widget.datasets.attachment_ids.length > 0">
|
||||
<a class="oe_mail_msg_view_attachments">
|
||||
<a class="oe_msg_view_attachments">
|
||||
<t t-if="widget.datasets.attachment_ids.length == 1">1 Attachment</t>
|
||||
<t t-if="widget.datasets.attachment_ids.length > 1"><t t-raw="widget.datasets.attachment_ids.length"/> Attachments</t>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="oe_clear"/>
|
||||
<div class="oe_mail_msg_body">
|
||||
<div class="oe_msg_body">
|
||||
<t t-if="widget.options.message.show_record_name and widget.datasets.record_name and (!widget.datasets.subject) and !widget.options.thread.thread_level and !widget.options.thread.display_on_thread[0] and widget.datasets.model!='res.partner'">
|
||||
<a class="oe_mail_action_model" t-attf-href="#model=#{widget.datasets.model}&id=#{widget.res_id}"><t t-raw="widget.datasets.record_name"/></a>
|
||||
</t>
|
||||
|
@ -241,8 +241,8 @@
|
|||
|
||||
<!-- expandable message layout -->
|
||||
<li t-name="mail.thread.expandable" class="oe_mail oe_mail_thread_msg oe_mail_unread">
|
||||
<div t-attf-class="oe_mail_msg_#{widget.datasets.type} oe_semantic_html_override">
|
||||
<div class="oe_mail_msg_content oe_mail_msg_more_message">
|
||||
<div t-attf-class="oe_msg_#{widget.datasets.type} oe_semantic_html_override">
|
||||
<div class="oe_msg_content oe_msg_more_message">
|
||||
<a class="oe_mail_fetch_more">Load more messages <span t-if="widget.datasets.nb_messages>0">(<t t-raw="widget.datasets.nb_messages"/> messages not display)</span>...</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -274,7 +274,7 @@
|
|||
agree
|
||||
</t>
|
||||
</span>
|
||||
<button t-attf-class="oe_mail_msg_vote oe_tag">
|
||||
<button t-attf-class="oe_msg_vote oe_tag">
|
||||
<span>
|
||||
<t t-if="!widget.datasets.has_voted">Agree</t>
|
||||
<t t-if="widget.datasets.has_voted">Unagree</t>
|
||||
|
|
Loading…
Reference in New Issue