Skip to content

Commit

Permalink
[MIG] mail_preview_audio: Migration to 14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jairo Llopis authored and pedroguirao committed Apr 19, 2022
1 parent f58df77 commit c09357f
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion mail_preview_audio/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Preview audio files",
"summary": """
Allow to preview audio files""",
"version": "13.0.1.0.0",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "Creu Blanca,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/social",
Expand Down
9 changes: 3 additions & 6 deletions mail_preview_audio/static/src/js/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,16 @@ odoo.define("audio_file.preview", function (require) {

DocumentViewer.include({
_checkAttachment: function (attachment) {
if (
attachment.type !== 'url' && attachment.mimetype.match("audio")
) {
attachment.type = 'audio';
if (attachment.type !== "url" && attachment.mimetype.match("audio")) {
attachment.type = "audio";
attachment.source_url = this._getImageUrl(attachment);
return true;
}
return this._super.apply(this, arguments);
},
_hasPreview: function (type) {
var result = this._super.apply(this, arguments);
return result || type === 'audio';
return result || type === "audio";
},
});

});
23 changes: 17 additions & 6 deletions mail_preview_audio/static/src/xml/preview.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-extend="DocumentViewer.Content">
<t t-jquery=".fa-video-camera" t-operation="after">
<i class="fa fa-volume-up mr8"
t-if="widget.activeAttachment.type == 'audio'"
role="img" aria-label="Audio" title="Audio"/>
<i
class="fa fa-volume-up mr8"
t-if="widget.activeAttachment.type == 'audio'"
role="img"
aria-label="Audio"
title="Audio"
/>
</t>
<t t-jquery=".o_viewer_video" t-operation="after">
<audio t-if="widget.activeAttachment.type == 'audio'" class="o_viewer_audio" controls="controls">
<source t-attf-src="#{widget.activeAttachment.source_url}" t-att-data-type="widget.activeAttachment.mimetype"/>
<audio
t-if="widget.activeAttachment.type == 'audio'"
class="o_viewer_audio"
controls="controls"
>
<source
t-attf-src="#{widget.activeAttachment.source_url}"
t-att-data-type="widget.activeAttachment.mimetype"
/>
</audio>
</t>
</t>
Expand Down
5 changes: 4 additions & 1 deletion mail_preview_audio/template/assets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
<odoo>
<template id="assets_backend" name="audio_assets" inherit_id="web.assets_backend">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/mail_preview_audio/static/src/js/preview.js" />
<script
type="text/javascript"
src="/mail_preview_audio/static/src/js/preview.js"
/>
</xpath>
</template>
</odoo>
1 change: 1 addition & 0 deletions setup/mail_preview_audio/odoo/addons/mail_preview_audio
6 changes: 6 additions & 0 deletions setup/mail_preview_audio/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit c09357f

Please sign in to comment.