diff options
| author | jpr-odoo <jpr@openerp.com> | 2019-02-18 06:47:16 +0000 |
|---|---|---|
| committer | jpr-odoo <jpr@openerp.com> | 2019-04-12 09:04:28 +0000 |
| commit | ee0a5ca4490ee83a0ed9d6e4f7382246b50da170 (patch) | |
| tree | 3000ebd70f099c24a487ab43d36c6356c3d093ce /addons/web/static/src/xml/base.xml | |
| parent | d6d7554a6ef57753285775bf2491e2a1a26434b4 (diff) | |
[MOV/IMP] web, mail: update attachment widget and moved the common scss code from mail to web
with this commit, we have updated the attachment widget view same as like chatter attachment view
moved the common scss code from mail to web for many2many_binary widget, which is used for attachment
and update test case according to the widget
Task ID: 1930087
Diffstat (limited to 'addons/web/static/src/xml/base.xml')
| -rw-r--r-- | addons/web/static/src/xml/base.xml | 63 |
1 files changed, 38 insertions, 25 deletions
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index f2b7c9653c6..6d00f21ab6f 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1089,33 +1089,46 @@ </t> </div> </div> -<div t-name="FieldBinaryFileUploader.files" class="oe_attachments" aria-atomic="true"> - <t t-if="widget.mode === 'readonly'"> - <div t-foreach="widget.value.data" t-as="file"> - <a target="_blank" t-att-href="widget.metadata[file.id].url" t-attf-title="#{(file.data.name || file.data.filename) + (file.data.date?' \n('+file.data.date+')':'' )}"><t t-raw="file.data.name || file.data.filename"/></a> - </div> - </t> - <t t-else="1"> - <div t-foreach="widget.value.data" t-as="file" class="oe_attachment"> - <t t-if="!file.data.upload"> - <div> - <a href="#" class="fa fa-times float-right oe_delete" title="Delete this file" aria-label="Delete this file" t-att-data-id="file.data.id"/> - <div class="caption"><t t-raw="file.data.name || file.data.filename"/></div> + +<t t-name="FieldBinaryFileUploader.attachment_preview"> + <t t-set="url" t-value="widget.metadata[file.id] ? widget.metadata[file.id].url : false"/> + <t t-if="file.data" t-set="file" t-value="file.data"/> + <t t-set="editable" t-value="widget.mode === 'edit'"/> + <t t-if="file.mimetype" t-set="mimetype" t-value="file.mimetype"/> + <div t-attf-class="o_attachment o_attachment_many2many #{ editable ? 'o_attachment_editable' : '' } #{upload ? 'o_attachment_uploading' : ''}" t-att-title="file.name"> + <div class="o_attachment_wrap"> + <t t-set="ext" t-value="file.name.replace(/^.*\./, '')"/> + <div class="o_image_box float-left" t-att-data-id="file.id"> + <a t-att-href="url" t-att-title="'Download ' + file.name" aria-label="Download"> + <span class="o_image o_hover" t-att-data-mimetype="mimetype" t-att-data-ext="ext" role="img"/> + </a> + </div> + + <div class="caption"> + <a class="ml4" t-att-href="url" t-att-title="'Download ' + file.name"><t t-esc='file.name'/></a> + </div> + <div class="caption small"> + <a class="ml4 small text-uppercase" t-att-href="url" t-att-title="'Download ' + file.name"><b><t t-esc='ext'/></b></a> + <div t-if="editable" class="progress o_attachment_progress_bar"> + <div class="progress-bar progress-bar-striped active" style="width: 100%">Uploading</div> </div> - <a class="o_image" target="_blank" t-att-href="widget.metadata[file.id] ? widget.metadata[file.id].url : false" - t-att-title="file.data.name" - t-att-aria-label="file.data.name" - t-att-data-mimetype="file.data.mimetype" - t-attf-data-src="/web/image/#{file.data.id}/100x80"/> - </t> - </div> - <div t-foreach="widget.uploadingFiles" t-as="file" class="oe_attachment"> - <div>Uploading...</div> - <a t-att-title="file.name" t-att-aria-label="file.name" t-att-name="file.name" class="o_image"> - <i class="fa fa-spinner fa-spin fa-5x fa-fw" role="img" aria-label="Loading, please wait..." title="Loading, please wait..."></i> - </a> - <div><t t-esc="file.name"/></div> + </div> + + <div t-if="editable" class="o_attachment_uploaded"><i class="text-success fa fa-check" role="img" aria-label="Uploaded" title="Uploaded"/></div> + <div t-if="editable" class="o_attachment_delete" t-att-data-id="file.id"><span class="text-white" role="img" aria-label="Delete" title="Delete">×</span></div> </div> + </div> +</t> + +<div t-name="FieldBinaryFileUploader.files" class="o_attachments" aria-atomic="true"> + <!-- uploaded files --> + <t t-foreach="widget.value.data" t-as="file"> + <t t-if="!file.data.upload" t-call="FieldBinaryFileUploader.attachment_preview"/> + </t> + <!-- uploading files --> + <t t-foreach="widget.uploadingFiles" t-as="file"> + <t t-set="upload" t-value="true"/> + <t t-call="FieldBinaryFileUploader.attachment_preview"/> </t> </div> |
