summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/components/attachment/attachment.xml
blob: 938ff8942c16b285c300dd4ff20bf13d1d6d369e (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">

    <t t-name="mail.Attachment" owl="1">
        <div class="o_Attachment"
            t-att-class="{
                'o-downloadable': props.isDownloadable,
                'o-editable': props.isEditable,
                'o-has-card-details': attachment and detailsMode === 'card',
                'o-temporary': attachment and attachment.isTemporary,
                'o-viewable': attachment and attachment.isViewable,
            }" t-att-title="attachment ? attachment.displayName : undefined" t-att-data-attachment-local-id="attachment ? attachment.localId : undefined"
        >
            <t t-if="attachment">
                <!-- Image style-->
                <!-- o_image from mimetype.scss -->
                <div class="o_Attachment_image o_image" t-on-click="_onClickImage"
                    t-att-class="{
                        'o-attachment-viewable': attachment.isViewable,
                        'o-details-overlay': detailsMode !== 'card',
                        'o-large': props.imageSize === 'large',
                        'o-medium': props.imageSize === 'medium',
                        'o-small': props.imageSize === 'small',
                    }" t-att-href="attachmentUrl" t-att-style="imageStyle" t-att-data-mimetype="attachment.mimetype"
                >
                    <t t-if="(props.showFilename or props.showExtension) and detailsMode === 'hover'">
                        <div class="o_Attachment_imageOverlay">
                            <div class="o_Attachment_details o_Attachment_imageOverlayDetails">
                                <t t-if="props.showFilename">
                                    <div class="o_Attachment_filename">
                                        <t t-esc="attachment.displayName"/>
                                    </div>
                                </t>
                                <t t-if="props.showExtension">
                                    <div class="o_Attachment_extension">
                                        <t t-esc="attachment.extension"/>
                                    </div>
                                </t>
                            </div>
                            <div class="o_Attachment_actions">
                                <!-- Remove button -->
                                <t t-if="props.isEditable" t-key="'unlink'">
                                    <div class="o_Attachment_action o_Attachment_actionUnlink"
                                        t-att-class="{
                                            'o-pretty': attachment.isLinkedToComposer,
                                        }" t-on-click="_onClickUnlink" title="Remove"
                                    >
                                        <i class="fa fa-times"/>
                                    </div>
                                </t>
                                <!-- Download button -->
                                <t t-if="props.isDownloadable and !attachment.isTemporary" t-key="'download'">
                                    <div class="o_Attachment_action o_Attachment_actionDownload" t-on-click="_onClickDownload" title="Download">
                                        <i class="fa fa-download"/>
                                    </div>
                                </t>
                            </div>
                        </div>
                    </t>
                </div>
                <!-- Attachment details -->
                <t t-if="(props.showFilename or props.showExtension) and detailsMode === 'card'">
                    <div class="o_Attachment_details">
                        <t t-if="props.showFilename">
                            <div class="o_Attachment_filename">
                                <t t-esc="attachment.displayName"/>
                            </div>
                        </t>
                        <t t-if="props.showExtension">
                            <div class="o_Attachment_extension">
                                <t t-esc="attachment.extension"/>
                            </div>
                        </t>
                    </div>
                </t>
                <!-- Attachment aside -->
                <t t-if="detailsMode !== 'hover' and (props.isDownloadable or props.isEditable)">
                    <div class="o_Attachment_aside" t-att-class="{ 'o-has-multiple-action': props.isDownloadable and props.isEditable }">
                        <!-- Uploading icon -->
                        <t t-if="attachment.isTemporary and attachment.isLinkedToComposer">
                            <div class="o_Attachment_asideItem o_Attachment_asideItemUploading" title="Uploading">
                                <i class="fa fa-spin fa-spinner"/>
                            </div>
                        </t>
                        <!-- Uploaded icon -->
                        <t t-if="!attachment.isTemporary and attachment.isLinkedToComposer">
                            <div class="o_Attachment_asideItem o_Attachment_asideItemUploaded" title="Uploaded">
                                <i class="fa fa-check"/>
                            </div>
                        </t>
                        <!-- Remove button -->
                        <t t-if="props.isEditable">
                            <div class="o_Attachment_asideItem o_Attachment_asideItemUnlink" t-att-class="{ 'o-pretty': attachment.isLinkedToComposer }" t-on-click="_onClickUnlink" title="Remove">
                                <i class="fa fa-times"/>
                            </div>
                        </t>
                        <!-- Download button -->
                        <t t-if="props.isDownloadable and !attachment.isTemporary">
                            <div class="o_Attachment_asideItem o_Attachment_asideItemDownload" t-on-click="_onClickDownload" title="Download">
                                <i class="fa fa-download"/>
                            </div>
                        </t>
                    </div>
                </t>
                <t t-if="state.hasDeleteConfirmDialog">
                    <AttachmentDeleteConfirmDialog
                        attachmentLocalId="props.attachmentLocalId"
                        t-on-dialog-closed="_onDeleteConfirmDialogClosed"
                    />
                </t>
            </t>
        </div>
    </t>

</templates>