summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/components/composer/composer.xml
blob: cc7038d3a92abb86eb42adcb02a57995acd2820d (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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">

    <t t-name="mail.Composer" owl="1">
        <div class="o_Composer"
            t-att-class="{
                'o-focused': composer and composer.hasFocus,
                'o-has-current-partner-avatar': props.hasCurrentPartnerAvatar,
                'o-has-footer': hasFooter,
                'o-has-header': hasHeader,
                'o-is-compact': props.isCompact,
            }"
            t-on-keydown="_onKeydown"
        >
            <t t-if="composer">
                <t t-if="isDropZoneVisible.value">
                    <DropZone
                        class="o_Composer_dropZone"
                        t-on-o-dropzone-files-dropped="_onDropZoneFilesDropped"
                        t-ref="dropzone"
                    />
                </t>
                <FileUploader
                    attachmentLocalIds="composer.attachments.map(attachment => attachment.localId)"
                    newAttachmentExtraData="newAttachmentExtraData"
                    t-ref="fileUploader"
                />
                <t t-if="hasHeader">
                    <div class="o_Composer_coreHeader">
                        <t t-if="props.hasThreadName and composer.thread">
                            <span class="o_Composer_threadName">
                                on: <b><t t-esc="composer.thread.displayName"/></b>
                            </span>
                        </t>
                        <t t-if="props.hasFollowers and !composer.isLog">
                            <!-- Text for followers -->
                            <small class="o_Composer_followers">
                                <b class="text-muted">To: </b>
                                <em class="text-muted">Followers of </em>
                                <b>
                                    <t t-if="composer.thread and composer.thread.name">
                                        &#32;&quot;<t t-esc="composer.thread.name"/>&quot;
                                    </t>
                                    <t t-else="">
                                        this document
                                    </t>
                                </b>
                            </small>
                            <ComposerSuggestedRecipientList
                                threadLocalId="composer.thread.localId"
                            />
                        </t>
                    </div>
                </t>
                <t t-if="composer.thread and composer.thread.model === 'mail.channel' and composer.thread.mass_mailing">
                    <div class="o_Composer_subject">
                        <input class="o_Composer_subjectInput" type="text" placeholder="Subject" t-on-input="_onInputSubject" t-ref="subject"/>
                    </div>
                </t>
                <t t-if="props.hasCurrentPartnerAvatar">
                    <div class="o_Composer_sidebarMain">
                        <img class="o_Composer_currentPartnerAvatar rounded-circle" t-att-src="currentPartnerAvatar" alt=""/>
                    </div>
                </t>
                <div
                    class="o_Composer_coreMain"
                    t-att-class="{
                        'o-composer-is-compact': props.isCompact,
                        'o-composer-is-extended': composer.thread and composer.thread.mass_mailing,
                    }"
                >
                    <TextInput
                        class="o_Composer_textInput"
                        t-att-class="{
                            'o-composer-is-compact': props.isCompact,
                            'o_Composer_textInput-mobile': env.messaging.device.isMobile,
                            'o-has-current-partner-avatar': props.hasCurrentPartnerAvatar,
                        }"
                        composerLocalId="composer.localId"
                        hasMentionSuggestionsBelowPosition="props.hasMentionSuggestionsBelowPosition"
                        isCompact="props.isCompact"
                        sendShortcuts="props.textInputSendShortcuts"
                        t-on-o-composer-suggestion-clicked="_onComposerSuggestionClicked"
                        t-on-o-composer-text-input-send-shortcut="_onComposerTextInputSendShortcut"
                        t-on-paste="_onPasteTextInput"
                        t-key="composer.localId"
                        t-ref="textInput"
                    />
                    <div class="o_Composer_buttons" t-att-class="{ 'o-composer-is-compact': props.isCompact, 'o-mobile': env.messaging.device.isMobile }">
                        <div class="o_Composer_toolButtons"
                            t-att-class="{
                                'o-composer-has-current-partner-avatar': props.hasCurrentPartnerAvatar,
                                'o-composer-is-compact': props.isCompact,
                            }">
                            <t t-if="props.isCompact">
                                <div class="o_Composer_toolButtonSeparator"/>
                            </t>
                            <div class="o_Composer_primaryToolButtons" t-att-class="{ 'o-composer-is-compact': props.isCompact }">
                                <Popover position="'top'" t-on-o-emoji-selection="_onEmojiSelection">
                                    <!-- TODO FIXME o-open not possible to code due to https://github.com/odoo/owl/issues/693 -->
                                    <button class="o_Composer_button o_Composer_buttonEmojis o_Composer_toolButton btn btn-light"
                                        t-att-class="{
                                            'o-open': false and state.displayed,
                                            'o-mobile': env.messaging.device.isMobile,
                                        }"
                                        t-on-keydown="_onKeydownEmojiButton"
                                    >
                                        <i class="fa fa-smile-o"/>
                                    </button>
                                    <t t-set="opened">
                                        <EmojisPopover t-ref="emojisPopover"/>
                                    </t>
                                </Popover>
                                <button class="o_Composer_button o_Composer_buttonAttachment o_Composer_toolButton btn btn-light fa fa-paperclip" t-att-class="{ 'o-mobile': env.messaging.device.isMobile }" title="Add attachment" type="button" t-on-click="_onClickAddAttachment"/>
                            </div>
                            <t t-if="props.isExpandable">
                                <div class="o_Composer_secondaryToolButtons">
                                    <button class="btn btn-light fa fa-expand o_Composer_button o_Composer_buttonFullComposer o_Composer_toolButton" t-att-class="{ 'o-mobile': env.messaging.device.isMobile }" title="Full composer" type="button" t-on-click="_onClickFullComposer"/>
                                </div>
                            </t>
                        </div>
                        <t t-if="props.isCompact">
                            <t t-call="mail.Composer.actionButtons"/>
                        </t>
                    </div>
                </div>
                <t t-if="hasFooter">
                    <div class="o_Composer_coreFooter" t-att-class="{ 'o-composer-is-compact': props.isCompact }">
                        <t t-if="props.hasThreadTyping">
                            <ThreadTextualTypingStatus class="o_Composer_threadTextualTypingStatus" threadLocalId="composer.thread.localId"/>
                        </t>
                        <t t-if="composer.attachments.length > 0">
                            <AttachmentList
                                class="o_Composer_attachmentList"
                                t-att-class="{ 'o-composer-is-compact': props.isCompact }"
                                areAttachmentsEditable="true"
                                attachmentsDetailsMode="props.attachmentsDetailsMode"
                                attachmentsImageSize="'small'"
                                attachmentLocalIds="composer.attachments.map(attachment => attachment.localId)"
                                showAttachmentsExtensions="props.showAttachmentsExtensions"
                                showAttachmentsFilenames="props.showAttachmentsFilenames"
                            />
                        </t>
                        <t t-if="!props.isCompact">
                            <t t-call="mail.Composer.actionButtons"/>
                        </t>
                    </div>
                </t>
            </t>
        </div>
    </t>

    <t t-name="mail.Composer.actionButtons" owl="1">
        <div class="o_Composer_actionButtons" t-att-class="{ 'o-composer-is-compact': props.isCompact }">
            <t t-if="props.hasSendButton">
                <button class="o_Composer_actionButton o_Composer_button o_Composer_buttonSend btn btn-primary"
                    t-att-class="{
                        'fa': env.messaging.device.isMobile,
                        'fa-paper-plane-o': env.messaging.device.isMobile,
                        'o-last': env.messaging.device.isMobile or !props.hasDiscardButton,
                        'o-composer-is-compact': props.isCompact,
                        'o-has-current-partner-avatar': props.hasCurrentPartnerAvatar,
                    }"
                    t-att-disabled="!composer.canPostMessage ? 'disabled' : ''"
                    type="button"
                    t-on-click="_onClickSend"
                >
                    <t t-if="!env.messaging.device.isMobile"><t t-if="composer.isLog">Log</t><t t-else="">Send</t></t>
                </button>
            </t>
            <t t-if="!env.messaging.device.isMobile and props.hasDiscardButton">
                <button class="o_Composer_actionButton o-last o_Composer_button o_Composer_buttonDiscard btn btn-secondary" t-att-class="{ 'o-composer-is-compact': props.isCompact, 'o-has-current-partner-avatar': props.hasCurrentPartnerAvatar }" type="button" t-on-click="_onClickDiscard">
                    Discard
                </button>
            </t>
        </div>
    </t>

</templates>