Skip to content

Commit ef103eb

Browse files
committed
👌 IMPROVE: put composer attachment buttons into three dot menu
Signed-off-by: Jonas Sulzer <jonas@violoncello.ch>
1 parent fbaa25c commit ef103eb

File tree

2 files changed

+35
-19
lines changed

2 files changed

+35
-19
lines changed

‎src/components/Composer.vue‎

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,26 @@
123123
></TextEditor>
124124
</div>
125125
<div class="composer-actions">
126-
<ComposerAttachments v-model="attachments" @upload="onAttachmentsUploading" />
126+
<ComposerAttachments ref="composerAttachments" v-model="attachments" @upload="onAttachmentsUploading" />
127127
<div class="composer-actions-right">
128128
<p class="composer-actions-draft">
129129
<span v-if="savingDraft === true" id="draft-status">{{ t('mail', 'Saving draft …') }}</span>
130130
<span v-else-if="savingDraft === false" id="draft-status">{{ t('mail', 'Draft saved') }}</span>
131131
</p>
132132
<Actions>
133-
<ActionText icon="icon-info">{{ t('mail', 'Message options') }}</ActionText>
134-
<ActionCheckbox :checked.sync="editorPlainText" :text="t('mail', 'Plain text')">{{
135-
t('mail', 'Plain text')
136-
}}</ActionCheckbox>
133+
<ActionButton icon="icon-upload" @click="onAddLocalAttachment">{{
134+
t('mail', 'Upload attachment')
135+
}}</ActionButton>
136+
<ActionButton icon="icon-folder" @click="onAddCloudAttachment">{{
137+
t('mail', 'Add attachment from Files')
138+
}}</ActionButton>
139+
<ActionCheckbox
140+
:checked="editorPlainText"
141+
:text="t('mail', 'Plain text')"
142+
@check="editorPlainText = true"
143+
@uncheck="editorPlainText = false"
144+
>{{ t('mail', 'Plain text') }}</ActionCheckbox
145+
>
137146
</Actions>
138147
<div>
139148
<input
@@ -169,8 +178,8 @@ import uniqBy from 'lodash/fp/uniqBy'
169178
import Autosize from 'vue-autosize'
170179
import debouncePromise from 'debounce-promise'
171180
import Actions from '@nextcloud/vue/dist/Components/Actions'
181+
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
172182
import ActionCheckbox from '@nextcloud/vue/dist/Components/ActionCheckbox'
173-
import ActionText from '@nextcloud/vue/dist/Components/ActionText'
174183
import Multiselect from '@nextcloud/vue/dist/Components/Multiselect'
175184
import {translate as t} from '@nextcloud/l10n'
176185
import Vue from 'vue'
@@ -198,8 +207,8 @@ export default {
198207
name: 'Composer',
199208
components: {
200209
Actions,
210+
ActionButton,
201211
ActionCheckbox,
202-
ActionText,
203212
ComposerAttachments,
204213
Loading,
205214
Multiselect,
@@ -348,6 +357,12 @@ export default {
348357
onInputChanged() {
349358
this.saveDraftDebounced(this.getMessageData())
350359
},
360+
onAddLocalAttachment() {
361+
this.$refs.composerAttachments.onAddLocalAttachment()
362+
},
363+
onAddCloudAttachment() {
364+
this.$refs.composerAttachments.onAddCloudAttachment()
365+
},
351366
onAutocomplete(term) {
352367
if (term === undefined || term === '') {
353368
return

‎src/components/ComposerAttachments.vue‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,12 @@
2828
</div>
2929
<div class="new-message-attachments-action svg icon-delete" @click="onDelete(attachment)"></div>
3030
</li>
31+
<li v-if="uploading" class="attachments-upload-progress">
32+
<div :class="{'icon-loading-small': uploading}"></div>
33+
<div>{{ uploading ? t('mail', 'Uploading {percent}% …', {percent: uploadProgress}) : '' }}</div>
34+
</li>
3135
</ul>
32-
<button class="button" :disabled="uploading" @click="onAddLocalAttachment">
33-
<span :class="{'icon-upload': !uploading, 'icon-loading-small': uploading}"></span>
34-
{{
35-
uploading
36-
? t('mail', 'Uploading {percent}% …', {percent: uploadProgress})
37-
: t('mail', 'Upload attachment')
38-
}}
39-
</button>
40-
<button class="button" @click="onAddCloudAttachment">
41-
<span class="icon-folder" />
42-
{{ t('mail', 'Add attachment from Files') }}
43-
</button>
36+
4437
<input ref="localAttachments" type="file" multiple style="display: none;" @change="onLocalAttachmentSelected" />
4538
</div>
4639
</template>
@@ -177,4 +170,12 @@ button {
177170
border: 1px solid #e9322d;
178171
background: #e9322d;
179172
}
173+
174+
.attachments-upload-progress {
175+
display: flex;
176+
}
177+
178+
.attachments-upload-progress > div {
179+
padding-left: 3px;
180+
}
180181
</style>

0 commit comments

Comments
 (0)