[IMP] mail.js: cleaned link behavior (not href anymore, delegated function for message_delete and message_read).
bzr revid: tde@openerp.com-20120911163853-y7g769dp53jym028
This commit is contained in:
parent
309e2353c6
commit
1bd02156eb
|
@ -410,6 +410,6 @@
|
|||
padding: 0;
|
||||
list-style-type: square;
|
||||
}
|
||||
.openerp .oe_mail_msg_content a.oe_mail_attachment_delete {
|
||||
.openerp .oe_mail_msg_content a {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
|
@ -316,10 +316,8 @@ openerp.mail = function(session) {
|
|||
* in the function. */
|
||||
bind_events: function() {
|
||||
var self = this;
|
||||
// event: click on 'more' at bottom of thread
|
||||
this.$el.find('button.oe_mail_button_more').click(function () {
|
||||
self.do_message_fetch();
|
||||
});
|
||||
// event: click on 'More' at bottom of thread
|
||||
this.$el.on('click', 'button.oe_mail_button_more', this.do_message_fetch_more);
|
||||
// event: writing in basic textarea of composition form (quick reply)
|
||||
this.$el.find('textarea.oe_mail_compose_textarea').keyup(function (event) {
|
||||
var charCode = (event.which) ? event.which : window.event.keyCode;
|
||||
|
@ -328,41 +326,21 @@ openerp.mail = function(session) {
|
|||
});
|
||||
// event: click on 'Reply' in msg
|
||||
this.$el.on('click', 'a.oe_mail_msg_reply', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var act_dom = $(this).parents('li.oe_mail_thread_msg').eq(0).find('div.oe_mail_thread_action:first');
|
||||
act_dom.toggle();
|
||||
});
|
||||
// event: click on 'attachment(s)' in msg
|
||||
// event: click on 'Attachment(s)' in msg
|
||||
this.$el.on('click', 'a.oe_mail_msg_view_attachments', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var act_dom = $(this).parent().parent().parent().find('.oe_mail_msg_attachments');
|
||||
act_dom.toggle();
|
||||
});
|
||||
// event: click on 'Delete' in msg side menu
|
||||
this.$el.on('click', 'a.oe_mail_msg_delete', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
if (! confirm(_t("Do you really want to delete this message?"))) { return false; }
|
||||
var msg_id = event.srcElement.dataset.id;
|
||||
if (! msg_id) return false;
|
||||
$(event.srcElement).parents('li.oe_mail_thread_msg').eq(0).remove();
|
||||
return self.ds_msg.unlink([parseInt(msg_id)]);
|
||||
});
|
||||
this.$el.on('click', 'a.oe_mail_msg_delete', this.on_message_delete);
|
||||
// event: click on 'Hide' in msg side menu
|
||||
this.$el.on('click', 'a.oe_mail_msg_hide', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var msg_id = event.srcElement.dataset.id;
|
||||
if (! msg_id) return false;
|
||||
$(event.srcElement).parents('li.oe_mail_thread_msg').eq(0).remove();
|
||||
return self.ds_notif.call('set_message_read', [parseInt(msg_id)]);
|
||||
});
|
||||
// event: click on "Reply by email" in msg side menu (email style)
|
||||
this.$el.on('click', 'a.oe_mail_msg_hide', this.on_message_read);
|
||||
// event: click on 'Reply by email' in msg side menu
|
||||
this.$el.on('click', 'a.oe_mail_msg_reply_by_email', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
if (! self.compose_message_widget) return true;
|
||||
var msg_id = event.srcElement.dataset.msg_id;
|
||||
if (! msg_id) return false;
|
||||
self.compose_message_widget.refresh({
|
||||
|
@ -372,11 +350,28 @@ openerp.mail = function(session) {
|
|||
});
|
||||
},
|
||||
|
||||
on_message_delete: function (event) {
|
||||
if (! confirm(_t("Do you really want to delete this message?"))) { return false; }
|
||||
var msg_id = event.srcElement.dataset.id;
|
||||
if (! msg_id) return false;
|
||||
$(event.srcElement).parents('li.oe_mail_thread_msg').eq(0).remove();
|
||||
return this.ds_message.unlink([parseInt(msg_id)]);
|
||||
},
|
||||
|
||||
on_message_read: function (event) {
|
||||
//TDE: TODO
|
||||
var msg_id = event.srcElement.dataset.id;
|
||||
if (! msg_id) return false;
|
||||
$(event.srcElement).parents('li.oe_mail_thread_msg').eq(0).remove();
|
||||
return this.ds_notification.call('set_message_read', [parseInt(msg_id)]);
|
||||
},
|
||||
|
||||
/**
|
||||
* Override-hack of do_action: automatically reload the chatter.
|
||||
* Normally it should be called only when clicking on 'Post/Send'
|
||||
* in the composition form. */
|
||||
do_action: function(action, on_close) {
|
||||
//TDE: TODO: instead of reloading, push the message ?
|
||||
this.message_clean();
|
||||
this.message_fetch();
|
||||
if (this.compose_message_widget) {
|
||||
|
@ -528,7 +523,7 @@ openerp.mail = function(session) {
|
|||
},
|
||||
|
||||
/** Action: 'shows more' to fetch new messages */
|
||||
do_message_fetch: function () {
|
||||
do_message_fetch_more: function () {
|
||||
return this.message_fetch(false, this.fetch_more_domain, this.fetch_more_context);
|
||||
},
|
||||
|
||||
|
|
|
@ -115,14 +115,14 @@
|
|||
<span class="oe_dropdown_toggle oe_dropdown_arrow">
|
||||
<ul class="oe_dropdown_menu">
|
||||
<t t-if="record.is_author">
|
||||
<li t-if="display['show_delete']"><a href="#" class="oe_mail_msg_delete" t-attf-data-id='{record.id}'>Delete</a></li>
|
||||
<li t-if="display['show_delete']"><a class="oe_mail_msg_delete" t-attf-data-id='{record.id}'>Delete</a></li>
|
||||
</t>
|
||||
<li t-if="display['show_hide']"><a href="#" class="oe_mail_msg_hide" t-attf-data-id='{record.id}'>Remove notification</a></li>
|
||||
<li t-if="display['show_hide']"><a class="oe_mail_msg_hide" t-attf-data-id='{record.id}'>Remove notification</a></li>
|
||||
<!-- Uncomment when adding subtype hiding
|
||||
<li t-if="display['show_hide']">
|
||||
<a href="#" class="oe_mail_msg_hide_type" t-attf-data-subtype='{record.subtype}'>Hide '<t t-esc="record.subtype"/>' for this document</a>
|
||||
</li> -->
|
||||
<li><a href="#" t-attf-data-msg_id="{record.id}" class="oe_mail_msg_reply_by_email">Quote and reply</a></li>
|
||||
<li><a t-attf-data-msg_id="{record.id}" class="oe_mail_msg_reply_by_email">Quote and reply</a></li>
|
||||
<li t-if="record.type == 'email'"><a t-attf-href="#model=mail.message&id=#{record.id}" class="oe_mail_msg_details">Details</a></li>
|
||||
</ul>
|
||||
</span>
|
||||
|
@ -142,12 +142,12 @@
|
|||
<li t-if="record.subject & params.thread_level > 0"><a t-attf-href="#model=#{record.model}&id=#{record.res_id}"><t t-raw="record.record_name"/></a></li>
|
||||
<li><a t-attf-href="#model=res.partner&id=#{record.author_id[0]}"><t t-raw="record.author_id[1]"/></a></li>
|
||||
<li><span t-att-title="record.date"><t t-raw="record.timerelative"/></span></li>
|
||||
<li t-if="display['show_reply']"><a href="#" class="oe_mail_msg_reply">Reply</a></li>
|
||||
<li t-if="display['show_reply']"><a class="oe_mail_msg_reply">Reply</a></li>
|
||||
<!-- uncomment when merging vote
|
||||
<li><a href="#">Like</a></li>
|
||||
-->
|
||||
<li t-if="record.attachment_ids.length > 0">
|
||||
<a href="#" class="oe_mail_msg_view_attachments">
|
||||
<a class="oe_mail_msg_view_attachments">
|
||||
<t t-if="record.attachment_ids.length == 1">1 Attachment</t>
|
||||
<t t-if="record.attachment_ids.length > 1"><t t-raw="record.attachment_ids.length"/> Attachments</t>
|
||||
</a>
|
||||
|
|
Loading…
Reference in New Issue