diff options
| author | Frédéric van der Essen <fva@openerp.com> | 2012-11-07 12:44:13 +0100 |
|---|---|---|
| committer | Frédéric van der Essen <fva@openerp.com> | 2012-11-07 12:44:13 +0100 |
| commit | 3b1478bf57f3da03e6a992e2d2c9b8df84b85c12 (patch) | |
| tree | 0c9225fe85a166f48ce6ea456a42ec09c4bc0feb /addons/mail/static/src | |
| parent | 4e073ba06882c4397b00d6f8177be905cb1c0cab (diff) | |
[IMP] mail: js dom bindings for the attachments
bzr revid: fva@openerp.com-20121107114413-399b2q2b5ziurxvp
Diffstat (limited to 'addons/mail/static/src')
| -rw-r--r-- | addons/mail/static/src/css/mail.css | 5 | ||||
| -rw-r--r-- | addons/mail/static/src/js/mail.js | 7 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/mail.xml | 10 |
3 files changed, 17 insertions, 5 deletions
diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index a1a9acd0a73..e43b7d33755 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -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; diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index e5529065aa6..46f8553f666 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -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. */ diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 3451566db46..02c29a3f1c2 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -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&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> |
