summaryrefslogtreecommitdiff
path: root/addons/web/static/src/xml/base.xml
diff options
context:
space:
mode:
authorMartin Geubelle <mge@odoo.com>2018-02-05 13:42:17 +0100
committerMartin Geubelle <mge@odoo.com>2018-02-12 11:16:21 +0100
commita7b521fe4401e921dc294ed3019f59c9027b345a (patch)
tree00d805df0f764d27d81f0cadec8d5da6eb6f4201 /addons/web/static/src/xml/base.xml
parentc265e47a6335e10467b748ff4a37808ed53263ca (diff)
[MOV] web, mrp: move `pdf_viewer` widget
This widget is generic enough to be used in other modules than mrp so we move it in the web module. Closes #22569
Diffstat (limited to 'addons/web/static/src/xml/base.xml')
-rw-r--r--addons/web/static/src/xml/base.xml26
1 files changed, 26 insertions, 0 deletions
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index ce432fea823..3ed21a8b0c3 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -907,6 +907,7 @@
</t>
</div>
</t>
+
<t t-name="HiddenInputFile">
<div t-attf-class="o_hidden_input_file #{fileupload_class or ''}" t-att-style="fileupload_style">
<form class="o_form_binary_form" t-att-target="fileupload_id"
@@ -921,6 +922,31 @@
<iframe t-att-id="fileupload_id" t-att-name="fileupload_id" style="display: none"/>
</div>
</t>
+
+<t t-name="FieldPdfViewer">
+ <div class="o_field_pdfviewer">
+ <div t-if="widget.mode !== 'readonly'" class="o_form_pdf_controls mt8">
+ <span class="o_form_binary_progress">Uploading...</span>
+ <button type="button" class="btn btn-sm btn-primary o_select_file_button" title="Select">Upload your file</button>
+ <button class="btn btn-sm btn-default fa fa-pencil o_select_file_button" title="Select" type="button"></button>
+ <button class="btn btn-sm btn-default fa fa-trash-o o_clear_file_button" title="Clear" type="button"></button>
+ </div>
+ <iframe class="o_pdfview_iframe o_field_pdfviewer"/>
+ <t t-call="HiddenInputPDFFile">
+ <t t-set="fileupload_id" t-value="widget.fileupload_id"/>
+ <t t-set="fileupload_style" t-translation="off">overflow-x: hidden</t>
+ </t>
+ </div>
+</t>
+
+<t t-name="HiddenInputPDFFile" t-extend="HiddenInputFile">
+ <!-- remove the inputs and put a new one for pdf only -->
+ <t t-jquery="input[type='file']" t-operation="replace"/>
+ <t t-jquery="form" t-operation="append">
+ <input type="file" class="o_input_file" name="ufile" accept="application/pdf"/>
+ </t>
+</t>
+
<div t-name="FieldBinaryFileUploader" t-attf-class="oe_fileupload #{widget.attrs.class ? widget.attrs.class :''}">
<div class="oe_placeholder_files"/>
<div t-if="widget.mode !== 'readonly'" class="oe_add">