[IMP] mail: js dom bindings for the attachments

bzr revid: fva@openerp.com-20121107114413-399b2q2b5ziurxvp
This commit is contained in:
Frédéric van der Essen
2012-11-07 12:44:13 +01:00
parent 4e073ba068
commit 3b1478bf57
3 changed files with 17 additions and 5 deletions
+5
View File
@@ -211,9 +211,13 @@
/* --------------------- ATTACHMENTS --------------------- */
.openerp .oe_mail .oe_msg_attachment_list{
display: none;
margin-top: 12px;
margin-bottom: 12px;
}
.openerp .oe_mail .oe_msg_composer .oe_msg_attachment_list{
display: block;
}
.openerp .oe_mail .oe_attachment{
display: inline-block;
width: 100px;
@@ -289,6 +293,7 @@
margin: 0px;
left: 0px;
right: 0px;
max-height: 64px;
background: rgba(0,0,0,0.8);
color: white;
border-top-left-radius: 0px;
+6 -1
View File
@@ -363,7 +363,7 @@ openerp.mail = function (session) {
display_attachments: function () {
this.$(".oe_msg_attachment_list").html( session.web.qweb.render('mail.thread.message.attachments', {'widget': this}) );
// event: delete an attachment
this.$(".oe_msg_attachment_list").on('click', '.oe_mail_attachment_delete', this.on_attachment_delete);
this.$(".oe_msg_attachment_list").on('click', '.oe_delete', this.on_attachment_delete);
},
/* when a user click on the upload button, send file read on_attachment_loaded
@@ -734,6 +734,11 @@ openerp.mail = function (session) {
this.$el.on('click', '.oe_msg_vote', this.on_vote);
// event: click on 'starred/favorite' button
this.$el.on('click', '.oe_star', this.on_star);
this.$el.on('click', '.oe_view_attachments', function(){
console.log('toggle');
self.$('.oe_msg_attachment_list').toggle(200);
});
},
/* Call the on_compose_message on the thread of this message. */
+6 -4
View File
@@ -73,7 +73,7 @@
<t t-foreach='widget.attachment_ids' t-as='attachment'>
<t t-if="widget.filetype(attachment) !== 'webimage'">
<div class='oe_attachment'>
<img t-att-src="'/mail/static/src/img/mimetypes/' + widget.filetype(attachment) + '.png'"></img>
<a t-att-href='attachment.url'><img t-att-src="'/mail/static/src/img/mimetypes/' + widget.filetype(attachment) + '.png'"></img></a>
<div class='oe_delete oe_e'>[</div>
<div class='oe_name'><t t-raw='widget.breakword(attachment.name || attachment.filename)' /></div>
<div class='oe_progress_bar'>
@@ -83,7 +83,7 @@
</t>
<t t-if="widget.filetype(attachment) === 'webimage'">
<div class='oe_attachment oe_preview'>
<img t-att-src="attachment.url"></img>
<a t-att-href='attachment.url'><img t-att-src="attachment.url"></img></a>
<div class='oe_delete oe_e'>[</div>
<div class='oe_name'><t t-raw='widget.breakword(attachment.name || attachment.filename)' /></div>
<div class='oe_progress_bar'>
@@ -218,11 +218,13 @@
<a t-if="widget.author_id" t-attf-href="#model=res.partner&amp;id=#{widget.author_id[0]}"><t t-raw="widget.author_id[1]"/></a>
<span class='oe_subtle'>•</span>
<span t-att-title="widget.date"><t t-raw="widget.timerelative"/></span>
<a t-if="widget.attachment_ids.length > 0" class="oe_mail_msg_view_attachments">
<span class='oe_subtle'>•</span>
<t t-if='widget.attachment_ids.length > 0'>
<span class='oe_subtle'>•</span>
<a class="oe_view_attachments">
<t t-if="widget.attachment_ids.length == 1">1 Attachment</t>
<t t-if="widget.attachment_ids.length > 1"><t t-raw="widget.attachment_ids.length"/> Attachments</t>
</a>
</t>
<span class='oe_subtle'>•</span>
<t t-call="mail.thread.message.vote"/>
</div>