Files
gzth/preview_easy/static/src/xml/qweb.xml
T
2024-11-09 16:18:46 +08:00

66 lines
3.5 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<templates xml:space="preserve">
<t t-inherit="web.Many2ManyBinaryField" t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('o_attachments')]" position="replace">
<t t-foreach="files" t-as="file" t-key="file_index">
<t t-call="Many2ManyBinaryField.attachment_preview1"/>
</t>
</xpath>
<xpath expr="//div[hasclass('oe_add')]" position="inside">
<button t-if="documentsInstalled and props.showSelectBtn" class="btn btn-secondary o_attach" t-on-click="onExternalBtnClick" data-tooltip="Attach">
<i class="fa fa-folder-open-o"/>
选择文件
<!-- <Many2XAutocomplete -->
<!-- id="props.id" -->
<!-- resModel="relation" -->
<!-- autoSelect="true" -->
<!-- fieldString="string" -->
<!-- activeActions="activeActions" -->
<!-- update="update" -->
<!-- quickCreate="activeActions.create ? quickCreate : null" -->
<!-- context="props.context" -->
<!-- getDomain.bind="getDomain" -->
<!-- isToMany="true" -->
<!-- nameCreateField="props.nameCreateField" -->
<!-- noSearchMore="props.noSearchMore" -->
<!-- /> -->
</button>
</xpath>
</t>
<t t-name="Many2ManyBinaryField.attachment_preview1" owl="1">
<t t-set="editable" t-value="!props.readonly"/>
<t t-if="props.previewType and props.previewType === 'button'">
<button class="btn btn-secondary o_attach" t-on-click.stop="() => this.preview_Obj(file.id,file.name)" data-tooltip="Attach">
<i class="fa fa-eye"/>
<span t-if="props.previewString" t-out="props.previewString"/>
<span t-else="" t-out="'预览文件'"/>
</button>
</t>
<t t-else="">
<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="getExtension(file)"/>
<t t-set="url" t-value="getUrl(file.id)"/>
<div class="o_image_box float-start" t-att-data-tooltip="'Preview ' + file.name">
<span class="o_image o_hover" t-on-click.stop="() => this.preview_Obj(file.id,file.name)" t-att-data-mimetype="file.mimetype" t-att-data-ext="ext" role="img"/>
</div>
<div class="caption">
<a class="ml4" t-att-data-tooltip="'Download ' + file.name" t-att-href="getUrl(file.id)"><t t-esc='file.name'/></a>
</div>
<div class="caption small">
<a class="ml4 small text-uppercase" t-att-href="getUrl(file.id)"><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>
</div>
<div 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-on-click.stop="() => this.onFileRemove(file.id)"><span class="text-white" role="img" aria-label="Delete" title="Delete">×</span></div>
</div>
</div>
</t>
</t>
</templates>