You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.4 KiB
44 lines
1.4 KiB
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
|
|
<template id="upload_file" name="Upload a file">
|
|
<div class="input-file-container">
|
|
<t t-if="user_input_line_upload_file">
|
|
<t t-foreach="user_input_line_upload_file" t-as="upload_file" t-if="upload_file.question_id.id == question.id">
|
|
<t t-if="upload_file.file_type == 'pdf'">
|
|
<a width="100px" height="100px" t-att-href="'data:application/pdf;base64,%s' % to_text(upload_file.file)" target="_blank">Download</a>
|
|
</t>
|
|
<t t-if="upload_file.file_type == 'image'">
|
|
<img width="100px" style="height: 100px;" class="img-thumbnail" t-att-src="'data:image/*;base64,%s' % to_text(upload_file.file)"/>
|
|
</t>
|
|
</t>
|
|
</t>
|
|
<t t-else="">
|
|
<div class="file-field" >
|
|
<input class="input-file" id="my-file" type="file" accept="image/*,application/pdf" t-att-name="prefix"/>
|
|
</div>
|
|
<br/>
|
|
</t>
|
|
</div>
|
|
<script>
|
|
$(document).ready(function(){
|
|
$(".img-thumbnail").click(function(){
|
|
if ( $(this).height() == 240) {
|
|
$(this).animate({
|
|
opacity: '0.8',
|
|
height: '100px',
|
|
width: '100px',
|
|
}, "slow");
|
|
} else {
|
|
$(this).animate({
|
|
opacity: '0.8',
|
|
height: '250px',
|
|
width: '250px',
|
|
}, "slow");
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</template>
|
|
|
|
</odoo>
|