summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/components/attachment_viewer/attachment_viewer.xml
blob: 8791bd09edfdfc1a4d0f6a02587d6caff40a79b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">

    <t t-name="mail.AttachmentViewer" owl="1">
        <div class="o_AttachmentViewer" t-on-click="_onClick" t-on-keydown="_onKeydown" tabindex="0">
            <div class="o_AttachmentViewer_header" t-on-click="_onClickHeader">
                <t t-if="attachmentViewer.attachment.fileType">
                    <div class="o_AttachmentViewer_headerItem o_AttachmentViewer_icon">
                        <t t-if="attachmentViewer.attachment.fileType === 'image'">
                            <i class="fa fa-picture-o" role="img" title="Image"/>
                        </t>
                        <t t-if="attachmentViewer.attachment.fileType === 'application/pdf'">
                            <i class="fa fa-file-text" role="img" title="PDF file"/>
                        </t>
                        <t t-if="attachmentViewer.attachment.isTextFile">
                            <i class="fa fa-file-text" role="img" title="Text file"/>
                        </t>
                        <t t-if="attachmentViewer.attachment.fileType === 'video'">
                            <i class="fa fa-video-camera" role="img" title="Video"/>
                        </t>
                    </div>
                </t>
                <div class="o_AttachmentViewer_headerItem o_AttachmentViewer_name">
                    <t t-esc="attachmentViewer.attachment.displayName"/>
                </div>
                <div class="o_AttachmentViewer_buttonDownload o_AttachmentViewer_headerItem o_AttachmentViewer_headerItemButton" t-on-click="_onClickDownload" role="button" title="Download">
                    <i class="fa fa-download fa-fw" role="img"/>
                </div>
                <div class="o-autogrow"/>
                <div class="o_AttachmentViewer_headerItem o_AttachmentViewer_headerItemButton o_AttachmentViewer_headerItemButtonClose" t-on-click="_onClickClose" role="button" title="Close (Esc)" aria-label="Close">
                    <i class="fa fa-fw fa-times" role="img"/>
                </div>
            </div>
            <div class="o_AttachmentViewer_main" t-att-class="{ o_with_img: attachmentViewer.attachment.fileType === 'image' }" t-on-mousemove="_onMousemoveView">
                <t t-if="attachmentViewer.attachment.fileType === 'image'">
                    <div class="o_AttachmentViewer_zoomer" t-ref="zoomer">
                        <t t-if="attachmentViewer.isImageLoading">
                            <div class="o_AttachmentViewer_loading">
                                <i class="fa fa-3x fa-circle-o-notch fa-fw fa-spin" role="img" title="Loading"/>
                            </div>
                        </t>
                        <img class="o_AttachmentViewer_view o_AttachmentViewer_viewImage" t-on-click="_onClickImage" t-on-mousedown="_onMousedownImage" t-on-wheel="_onWheelImage" t-on-load="_onLoadImage" t-att-src="attachmentViewer.attachment.defaultSource" t-att-style="imageStyle" draggable="false" alt="Viewer" t-key="'image_' + attachmentViewer.attachment.id" t-ref="image_{{ attachmentViewer.attachment.id }}"/>
                    </div>
                </t>
                <t t-if="attachmentViewer.attachment.fileType === 'application/pdf'">
                    <iframe class="o_AttachmentViewer_view o_AttachmentViewer_viewIframe o_AttachmentViewer_viewPdf" t-att-src="attachmentViewer.attachment.defaultSource"/>
                </t>
                <t t-if="attachmentViewer.attachment.isTextFile">
                    <iframe class="o_AttachmentViewer_view o_AttachmentViewer_viewIframe o_text" t-att-src="attachmentViewer.attachment.defaultSource"/>
                </t>
                <t t-if="attachmentViewer.attachment.fileType === 'youtu'">
                    <iframe allow="autoplay; encrypted-media" class="o_AttachmentViewer_view o_AttachmentViewer_viewIframe o_AttachmentViewer_youtube" t-att-src="attachmentViewer.attachment.defaultSource" height="315" width="560"/>
                </t>
                <t t-if="attachmentViewer.attachment.fileType === 'video'">
                    <video class="o_AttachmentViewer_view o_AttachmentViewer_viewVideo" t-on-click="_onClickVideo" controls="controls">
                        <source t-att-data-type="attachmentViewer.attachment.mimetype" t-att-src="attachmentViewer.attachment.defaultSource"/>
                    </video>
                </t>
            </div>
            <t t-if="attachmentViewer.attachment.fileType === 'image'">
                <div class="o_AttachmentViewer_toolbar" role="toolbar">
                    <div class="o_AttachmentViewer_toolbarButton" t-on-click="_onClickZoomIn" title="Zoom In (+)" role="button">
                        <i class="fa fa-fw fa-plus" role="img"/>
                    </div>
                    <div class="o_AttachmentViewer_toolbarButton" t-att-class="{ o_disabled: attachmentViewer.scale === 1 }" t-on-click="_onClickZoomReset" role="button" title="Reset Zoom (0)">
                        <i class="fa fa-fw fa-search" role="img"/>
                    </div>
                    <div class="o_AttachmentViewer_toolbarButton" t-att-class="{ o_disabled: attachmentViewer.scale === MIN_SCALE }" t-on-click="_onClickZoomOut" title="Zoom Out (-)" role="button">
                        <i class="fa fa-fw fa-minus" role="img"/>
                    </div>
                    <div class="o_AttachmentViewer_toolbarButton" t-on-click="_onClickRotate" title="Rotate (r)" role="button">
                        <i class="fa fa-fw fa-repeat" role="img"/>
                    </div>
                    <div class="o_AttachmentViewer_toolbarButton" t-on-click="_onClickPrint" title="Print" role="button">
                        <i class="fa fa-fw fa-print" role="img"/>
                    </div>
                    <div class="o_AttachmentViewer_buttonDownload o_AttachmentViewer_toolbarButton" t-on-click="_onClickDownload" title="Download" role="button">
                        <i class="fa fa-download fa-fw" role="img"/>
                    </div>
                </div>
            </t>
            <t t-if="attachmentViewer.attachments.length > 1">
                <div class="o_AttachmentViewer_buttonNavigation o_AttachmentViewer_buttonNavigationPrevious" t-on-click="_onClickPrevious" title="Previous (Left-Arrow)" role="button">
                    <span class="fa fa-chevron-left" role="img"/>
                </div>
                <div class="o_AttachmentViewer_buttonNavigation o_AttachmentViewer_buttonNavigationNext" t-on-click="_onClickNext" title="Next (Right-Arrow)" role="button">
                    <span class="fa fa-chevron-right" role="img"/>
                </div>
            </t>
        </div>
    </t>

</templates>