Odoo modules related to surveys
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.

43 lines
1.4 KiB

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <template id="upload_file" name="Upload a file">
  4. <div class="input-file-container">
  5. <t t-set="user_input_line" t-value="survey.user_input_ids.filtered(lambda sui: sui.token == token).user_input_line_ids.filtered(lambda suil: suil.question_id == question)"/>
  6. <t t-if="user_input_line">
  7. <t t-if="user_input_line.file_type == 'pdf'">
  8. <a width="100px" height="100px" t-att-href="'data:application/pdf;base64,%s' % to_text(user_input_line.file)" target="_blank">Download <t t-esc="user_input_line.filename"/></a>
  9. </t>
  10. <t t-elif="user_input_line.file_type == 'image'">
  11. <img width="100px" style="height: 100px;" class="img-thumbnail" t-att-src="'data:image/*;base64,%s' % to_text(user_input_line.file)"/>
  12. </t>
  13. </t>
  14. <t t-else="">
  15. <div class="file-field">
  16. <input class="input-file" id="my-file" type="file" accept="image/*,application/pdf" t-att-name="prefix"/>
  17. </div>
  18. <!-- <br/> -->
  19. </t>
  20. </div>
  21. <script>
  22. $(document).ready(function(){
  23. $(".img-thumbnail").click(function(){
  24. if ( $(this).height() == 240) {
  25. $(this).animate({
  26. opacity: '0.8',
  27. height: '100px',
  28. width: '100px',
  29. }, "slow");
  30. } else {
  31. $(this).animate({
  32. opacity: '0.8',
  33. height: '250px',
  34. width: '250px',
  35. }, "slow");
  36. }
  37. });
  38. });
  39. </script>
  40. </template>
  41. </odoo>