优化communication详情页工具栏按钮
This commit is contained in:
parent
793d6ddea2
commit
f81b18d2d0
@ -103,20 +103,20 @@
|
||||
{{ t('Reply') }}
|
||||
</n-button>
|
||||
|
||||
<!-- Actions dropdown: Reply All, Forward, Mark as Read/Unread, Move, Mark as Spam, Move to Trash -->
|
||||
<n-dropdown
|
||||
<!-- Forward -->
|
||||
<n-button
|
||||
v-if="canReply"
|
||||
:options="actionsOptions"
|
||||
trigger="click"
|
||||
:render-icon="renderMenuIcon"
|
||||
@select="handleActionsSelect"
|
||||
type="default"
|
||||
size="medium"
|
||||
@click="forward"
|
||||
:disabled="loading"
|
||||
class="header-action-btn"
|
||||
>
|
||||
<n-button type="default" size="medium" class="header-action-btn">
|
||||
<template #icon>
|
||||
<n-icon><Icon icon="tabler:chevron-down" /></n-icon>
|
||||
</template>
|
||||
</n-button>
|
||||
</n-dropdown>
|
||||
<template #icon>
|
||||
<n-icon><Icon icon="tabler:send" /></n-icon>
|
||||
</template>
|
||||
{{ t('Forward') }}
|
||||
</n-button>
|
||||
|
||||
<!-- Relink -->
|
||||
<n-button
|
||||
@ -740,41 +740,6 @@ function renderMenuIcon(option: DropdownOption) {
|
||||
return h(NIcon, null, { default: () => h(Icon, { icon: iconName }) })
|
||||
}
|
||||
|
||||
// ===== Dropdown options =====
|
||||
const actionsOptions = computed<DropdownOption[]>(() => {
|
||||
const opts: DropdownOption[] = []
|
||||
|
||||
const replyAll = makeOption('reply_all', t('Reply All'), 'tabler:arrow-back-up-right')
|
||||
if (replyAll) opts.push(replyAll)
|
||||
|
||||
const forward = makeOption('forward', t('Forward'), 'tabler:send')
|
||||
if (forward) opts.push(forward)
|
||||
|
||||
opts.push({ type: 'divider', key: 'd1' })
|
||||
|
||||
const readLabel = isSeen.value ? t('Mark as Unread') : t('Mark as Read')
|
||||
const readIcon = isSeen.value ? 'tabler:mail-opened' : 'tabler:mail-check'
|
||||
const toggleRead = makeOption('toggle_read', readLabel, readIcon)
|
||||
if (toggleRead) opts.push(toggleRead)
|
||||
|
||||
const move = makeOption('move', t('Move'), 'tabler:folder-arrow-right')
|
||||
if (move) opts.push(move)
|
||||
|
||||
opts.push({ type: 'divider', key: 'd2' })
|
||||
|
||||
if (!isSpam.value) {
|
||||
const spam = makeOption('spam', t('Mark as Spam'), 'tabler:alert-triangle')
|
||||
if (spam) opts.push(spam)
|
||||
}
|
||||
|
||||
if (!isTrash.value) {
|
||||
const trash = makeOption('trash', t('Move To Trash'), 'tabler:trash')
|
||||
if (trash) opts.push(trash)
|
||||
}
|
||||
|
||||
return opts
|
||||
})
|
||||
|
||||
const createOptions = computed<DropdownOption[]>(() => {
|
||||
const contact = makeOption('contact', t('Contact'), 'tabler:user-plus')
|
||||
return contact ? [contact] : []
|
||||
@ -783,6 +748,33 @@ const createOptions = computed<DropdownOption[]>(() => {
|
||||
const moreOptions = computed<DropdownOption[]>(() => {
|
||||
const opts: DropdownOption[] = []
|
||||
|
||||
// Email action items (from former Actions dropdown)
|
||||
if (canReply.value) {
|
||||
const replyAll = makeOption('reply_all', t('Reply All'), 'tabler:arrow-back-up-right')
|
||||
if (replyAll) opts.push(replyAll)
|
||||
|
||||
const readLabel = isSeen.value ? t('Mark as Unread') : t('Mark as Read')
|
||||
const readIcon = isSeen.value ? 'tabler:mail-opened' : 'tabler:mail-check'
|
||||
const toggleRead = makeOption('toggle_read', readLabel, readIcon)
|
||||
if (toggleRead) opts.push(toggleRead)
|
||||
|
||||
const move = makeOption('move', t('Move'), 'tabler:folder-arrow-right')
|
||||
if (move) opts.push(move)
|
||||
|
||||
if (!isSpam.value) {
|
||||
const spam = makeOption('spam', t('Mark as Spam'), 'tabler:alert-triangle')
|
||||
if (spam) opts.push(spam)
|
||||
}
|
||||
|
||||
if (!isTrash.value) {
|
||||
const trash = makeOption('trash', t('Move To Trash'), 'tabler:trash')
|
||||
if (trash) opts.push(trash)
|
||||
}
|
||||
|
||||
opts.push({ type: 'divider', key: 'd-email-actions' })
|
||||
}
|
||||
|
||||
// General more items
|
||||
if (!isNew.value && props.canEdit && !props.pageMeta?.allow_copy) {
|
||||
const dup = makeOption('duplicate', t('Duplicate'), 'tabler:copy')
|
||||
if (dup) opts.push(dup)
|
||||
@ -802,17 +794,6 @@ const moreOptions = computed<DropdownOption[]>(() => {
|
||||
return opts
|
||||
})
|
||||
|
||||
function handleActionsSelect(key: string) {
|
||||
switch (key) {
|
||||
case 'reply_all': replyAll(); break
|
||||
case 'forward': forward(); break
|
||||
case 'toggle_read': markAsReadUnread(); break
|
||||
case 'move': openMoveDialog(); break
|
||||
case 'spam': markAsSpam(); break
|
||||
case 'trash': moveToTrash(); break
|
||||
}
|
||||
}
|
||||
|
||||
function handleCreateSelect(key: string) {
|
||||
switch (key) {
|
||||
case 'contact': addToContact(); break
|
||||
@ -821,6 +802,11 @@ function handleCreateSelect(key: string) {
|
||||
|
||||
function handleMoreSelect(key: string) {
|
||||
switch (key) {
|
||||
case 'reply_all': replyAll(); break
|
||||
case 'toggle_read': markAsReadUnread(); break
|
||||
case 'move': openMoveDialog(); break
|
||||
case 'spam': markAsSpam(); break
|
||||
case 'trash': moveToTrash(); break
|
||||
case 'rename': emit('rename', '')
|
||||
break
|
||||
case 'duplicate': emit('duplicate', '')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user