[IMP] mail layout simplications
bzr revid: al@openerp.com-20120622012102-ysfvjdj2jkhshuwq
This commit is contained in:
parent
d4003f2ac9
commit
3821fcc47f
|
@ -199,11 +199,6 @@
|
||||||
.openerp .oe_mail_msg_comment,
|
.openerp .oe_mail_msg_comment,
|
||||||
.openerp .oe_mail_msg_email {
|
.openerp .oe_mail_msg_email {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
}
|
|
||||||
|
|
||||||
.openerp .oe_mail_msg_comment,
|
|
||||||
.openerp .oe_mail_msg_email,
|
|
||||||
.openerp .oe_mail_msg_notification {
|
|
||||||
background: white;
|
background: white;
|
||||||
border-top: 1px solid #ccc;
|
border-top: 1px solid #ccc;
|
||||||
}
|
}
|
||||||
|
@ -314,12 +309,15 @@
|
||||||
color: #888;
|
color: #888;
|
||||||
}
|
}
|
||||||
|
|
||||||
.openerp .oe_mail_msg_body,
|
.openerp .oe_mail_msg_body {
|
||||||
.openerp .oe_mail_msg_body_short {
|
|
||||||
margin-bottom: .5em;
|
margin-bottom: .5em;
|
||||||
text-align: justify;
|
text-align: justify;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.openerp .oe_mail_msg_tail {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* Read more/less link */
|
/* Read more/less link */
|
||||||
.openerp .oe_mail_msg_content .expand,
|
.openerp .oe_mail_msg_content .expand,
|
||||||
.openerp .oe_mail_msg_content .reduce {
|
.openerp .oe_mail_msg_content .reduce {
|
||||||
|
|
|
@ -57,8 +57,6 @@ openerp.mail = function(session) {
|
||||||
return cs;
|
return cs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add ThreadDisplay widget to registry */
|
|
||||||
session.web.form.widgets.add( 'Thread', 'openerp.mail.Thread');
|
|
||||||
/**
|
/**
|
||||||
* ThreadDisplay widget: this widget handles the display of a thread of
|
* ThreadDisplay widget: this widget handles the display of a thread of
|
||||||
* messages. The [thread_level] parameter sets the thread level number:
|
* messages. The [thread_level] parameter sets the thread level number:
|
||||||
|
@ -206,6 +204,13 @@ openerp.mail = function(session) {
|
||||||
act_dom.toggle();
|
act_dom.toggle();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
// see more
|
||||||
|
this.$element.on('click','a.oe_mail_msg_more', function (event) {
|
||||||
|
console.log("sadf");
|
||||||
|
$(this).siblings('.oe_mail_msg_tail').show();
|
||||||
|
$(this).hide();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function () {
|
destroy: function () {
|
||||||
|
@ -230,15 +235,6 @@ openerp.mail = function(session) {
|
||||||
else { self.display.show_more = true; records.pop(); }
|
else { self.display.show_more = true; records.pop(); }
|
||||||
|
|
||||||
//build attachments download urls and compute time-relative from dates
|
//build attachments download urls and compute time-relative from dates
|
||||||
for (var k in records) {
|
|
||||||
records[k].timerelative = $.timeago(records[k].date);
|
|
||||||
|
|
||||||
if (records[k].attachments) {
|
|
||||||
for (var l in records[k].attachments) {
|
|
||||||
records[k].attachments[l].url = self.session.origin + '/web/binary/saveas?session_id=' + self.session.session_id + '&model=ir.attachment&field=datas&filename_field=datas_fname&id='+records[k].attachments[l].id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self.display_comments(records);
|
self.display_comments(records);
|
||||||
if (self.display.show_more == true) self.$element.find('div.oe_mail_thread_more:last').show();
|
if (self.display.show_more == true) self.$element.find('div.oe_mail_thread_more:last').show();
|
||||||
|
@ -259,13 +255,16 @@ openerp.mail = function(session) {
|
||||||
|
|
||||||
display_comments: function (records) {
|
display_comments: function (records) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
for (var k in records) {
|
||||||
|
records[k].timerelative = $.timeago(records[k].date);
|
||||||
|
if (records[k].attachments) {
|
||||||
|
for (var l in records[k].attachments) {
|
||||||
|
var url = self.session.origin + '/web/binary/saveas?session_id=' + self.session.session_id + '&model=ir.attachment&field=datas&filename_field=datas_fname&id='+records[k].attachments[l].id;
|
||||||
|
records[k].attachments[l].url = url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
this.cs = this.sort_comments_tmp(records);
|
this.cs = this.sort_comments_tmp(records);
|
||||||
|
|
||||||
/* WIP: map matched regexp -> records to browse with name */
|
|
||||||
//_(records).each(function (record) {
|
|
||||||
//self.do_check_internal_links(record.body_text);
|
|
||||||
//});
|
|
||||||
|
|
||||||
_(records).each(function (record) {
|
_(records).each(function (record) {
|
||||||
var sub_msgs = [];
|
var sub_msgs = [];
|
||||||
if ((record.parent_id == false || record.parent_id[0] == self.params.parent_id) && self.params.thread_level > 0 ) {
|
if ((record.parent_id == false || record.parent_id[0] == self.params.parent_id) && self.params.thread_level > 0 ) {
|
||||||
|
@ -302,23 +301,19 @@ openerp.mail = function(session) {
|
||||||
}
|
}
|
||||||
// body text manipulation
|
// body text manipulation
|
||||||
record.body = this.do_clean_text(record.body);
|
record.body = this.do_clean_text(record.body);
|
||||||
record.tr_body = this.do_truncate_string(record.body, this.params.msg_more_limit);
|
|
||||||
record.body = this.do_replace_internal_links(record.body);
|
record.body = this.do_replace_internal_links(record.body);
|
||||||
if (record.tr_body) record.tr_body = this.do_replace_internal_links(record.tr_body);
|
|
||||||
|
// split for see mode
|
||||||
|
var split = this.do_truncate_string(record.body, this.params.msg_more_limit);
|
||||||
|
record.body_head = split[0];
|
||||||
|
record.body_tail = split[1];
|
||||||
|
|
||||||
// format date according to the user timezone
|
// format date according to the user timezone
|
||||||
record.date = session.web.format_value(record.date, {type:"datetime"});
|
record.date = session.web.format_value(record.date, {type:"datetime"});
|
||||||
// render
|
|
||||||
// OPTIONS
|
|
||||||
|
|
||||||
var rendered = session.web.qweb.render('mail.Thread.message', {'record': record, 'thread': this, 'params': this.params, 'display': this.display});
|
var rendered = session.web.qweb.render('mail.Thread.message', {'record': record, 'thread': this, 'params': this.params, 'display': this.display});
|
||||||
$( rendered).appendTo(this.$element.children('div.oe_mail_thread_display:first'));
|
$( rendered).appendTo(this.$element.children('div.oe_mail_thread_display:first'));
|
||||||
// truncated: hide full-text, show summary, add buttons
|
|
||||||
if (record.tr_body) {
|
|
||||||
var node_body = this.$element.find('.oe_mail_msg_body:last');
|
|
||||||
var node_body_short = this.$element.find('.oe_mail_msg_body_short:last').append('... <a href="#" class="expand">See more</a>');
|
|
||||||
node_body.hide();
|
|
||||||
node_body_short.find('a:last').click(function() { node_body_short.hide(); node_body.show(); return false; });
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -461,9 +456,9 @@ openerp.mail = function(session) {
|
||||||
do_truncate_string: function(string, max_length) {
|
do_truncate_string: function(string, max_length) {
|
||||||
// multiply by 1.2: prevent truncating an just too little long string
|
// multiply by 1.2: prevent truncating an just too little long string
|
||||||
if (string.length <= (max_length * 1.2)) {
|
if (string.length <= (max_length * 1.2)) {
|
||||||
return false;
|
return [string, ""];
|
||||||
} else {
|
} else {
|
||||||
return string.slice(0, max_length);
|
return [string.slice(0, max_length), string.slice(max_length)];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -512,10 +507,9 @@ openerp.mail = function(session) {
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
|
session.web.form.widgets.add( 'Thread', 'openerp.mail.Thread');
|
||||||
|
|
||||||
/* Add ThreadView widget to registry */
|
/** ThreadView widget: thread of comments */
|
||||||
session.web.form.widgets.add( 'ThreadView', 'openerp.mail.RecordThread');
|
|
||||||
/* ThreadView widget: thread of comments */
|
|
||||||
mail.RecordThread = session.web.form.AbstractField.extend({
|
mail.RecordThread = session.web.form.AbstractField.extend({
|
||||||
template: 'mail.RecordThread',
|
template: 'mail.RecordThread',
|
||||||
|
|
||||||
|
@ -616,11 +610,9 @@ openerp.mail = function(session) {
|
||||||
return this.session.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + (id || '');
|
return this.session.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + (id || '');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
session.web.form.widgets.add( 'ThreadView', 'openerp.mail.RecordThread');
|
||||||
|
|
||||||
|
/** WallView widget: a wall of messages */
|
||||||
/* Add WallView widget to registry */
|
|
||||||
session.web.client_actions.add('mail.all_feeds', 'session.mail.WallView');
|
|
||||||
/* WallView widget: a wall of messages */
|
|
||||||
mail.WallView = session.web.Widget.extend({
|
mail.WallView = session.web.Widget.extend({
|
||||||
template: 'mail.Wall',
|
template: 'mail.Wall',
|
||||||
|
|
||||||
|
@ -818,6 +810,7 @@ openerp.mail = function(session) {
|
||||||
var call_done = this.ds_users.call('message_append_note', [[this.session.uid], 'Tweet', body_text, false, 'comment', 'html']).then(this.proxy('init_and_fetch_comments'));
|
var call_done = this.ds_users.call('message_append_note', [[this.session.uid], 'Tweet', body_text, false, 'comment', 'html']).then(this.proxy('init_and_fetch_comments'));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
session.web.client_actions.add('mail.all_feeds', 'session.mail.WallView');
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -68,42 +68,35 @@
|
||||||
<t t-if="!thread._is_author(record.user_id[0]) && display['show_hide']">
|
<t t-if="!thread._is_author(record.user_id[0]) && display['show_hide']">
|
||||||
<li><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_hide">Hide</a></li>
|
<li><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_hide">Hide</a></li>
|
||||||
</t>
|
</t>
|
||||||
|
<li t-if="record.type == 'email'"><a href="#" class="oe_mail_msg_details">Details</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div class="oe_mail_msg">
|
<div class="oe_mail_msg">
|
||||||
<t t-if="record.subject">
|
<h1 t-if="record.subject && record.subject != 'Reply'" class="oe_mail_msg_title">
|
||||||
<h1 class="oe_mail_msg_title">
|
<t t-raw="record.subject"/>
|
||||||
<a href="#" class="oe_mail_internal_link"><t t-raw="record.subject"/></a>
|
</h1>
|
||||||
</h1>
|
<div t-if="params.thread_level > 0" class="oe_mail_msg_subtitle">
|
||||||
</t>
|
<a href="#" t-attf-data-res-model='{params.res_model}' t-attf-data-res-id='{params.res_id}' class="oe_mail_internal_link"><t t-raw="record.record_name"/></a>
|
||||||
|
</div>
|
||||||
<p class="oe_mail_msg_subtitle">
|
<div class="oe_mail_msg_body">
|
||||||
<t t-if="params.thread_level > 0">
|
<a href="#" data-res-model='res.users' t-attf-data-res-id='{record.user_id[0]}' class="oe_mail_internal_link"><t t-raw="record.user_id[1]"/></a>
|
||||||
<a href="#" t-attf-data-res-model='{params.res_model}' t-attf-data-res-id='{params.res_id}' class="oe_mail_internal_link"><t t-raw="record.record_name"/></a>
|
<t t-raw="record.body_head"/>
|
||||||
|
<t t-if="record.body_tail"><a href="#" class="oe_mail_msg_more">... See more</a>
|
||||||
|
<span class="oe_mail_msg_tail"><t t-raw="record.body_tail"/></span>
|
||||||
</t>
|
</t>
|
||||||
<span class="oe_mail_msg_author"><a href="#" data-res-model='res.users' t-attf-data-res-id='{record.user_id[0]}' class="oe_mail_internal_link"><t t-raw="record.user_id[1]"/></a></span>
|
</div>
|
||||||
<span class="oe_mail_msg_date" t-att-title="record.date"><t t-raw="record.timerelative"/></span>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="oe_mail_msg_body"><t t-raw="record.body"/></div>
|
|
||||||
<t t-if="record.tr_body">
|
|
||||||
<div class="oe_mail_msg_body_short"><t t-raw="record.tr_body"/></div>
|
|
||||||
</t>
|
|
||||||
|
|
||||||
<ul class="oe_mail_msg_footer">
|
<ul class="oe_mail_msg_footer">
|
||||||
<t t-if="display['show_reply']">
|
<li><span t-att-title="record.date"><t t-raw="record.timerelative"/></span></li>
|
||||||
<li><a href="#" class="oe_mail_msg_reply">Reply</a></li>
|
<li t-if="display['show_reply']"><a href="#" class="oe_mail_msg_reply">Reply</a></li>
|
||||||
</t>
|
<!-- uncomment when merging vote
|
||||||
<li><a href="#">Like</a></li>
|
<li><a href="#">Like</a></li>
|
||||||
<t t-if="record.attachment_ids.length > 0">
|
-->
|
||||||
<li>
|
<li t-if="record.attachment_ids.length > 0">
|
||||||
<a href="#" class="oe_mail_msg_view_attachments">
|
<a href="#" class="oe_mail_msg_view_attachments">
|
||||||
<t t-if="record.attachment_ids.length == 1">Attachment</t>
|
<t t-if="record.attachment_ids.length == 1">Attachment</t>
|
||||||
<t t-if="record.attachment_ids.length > 1">Attachments (<t t-raw="record.attachment_ids.length"/>)</t>
|
<t t-if="record.attachment_ids.length > 1">Attachments (<t t-raw="record.attachment_ids.length"/>)</t>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</t>
|
|
||||||
</ul>
|
</ul>
|
||||||
<t t-if="record.attachment_ids.length > 0">
|
<t t-if="record.attachment_ids.length > 0">
|
||||||
<div class="oe_clear"></div>
|
<div class="oe_clear"></div>
|
||||||
|
@ -117,6 +110,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue