fix: update duplicate event title logic
This commit is contained in:
parent
74f6f65210
commit
11d1b3a67a
@ -98,16 +98,16 @@
|
|||||||
variant="ghost"
|
variant="ghost"
|
||||||
theme="gray"
|
theme="gray"
|
||||||
class="rounded-full w-fit !h-8.5 !pr-3"
|
class="rounded-full w-fit !h-8.5 !pr-3"
|
||||||
:tooltip="__('Owner: {0}', [_event.owner.label])"
|
:tooltip="__('Owner: {0}', [_event.owner?.label])"
|
||||||
>
|
>
|
||||||
<template #default>
|
<template #default>
|
||||||
<div class="flex flex-col justify-start items-start text-sm">
|
<div class="flex flex-col justify-start items-start text-sm">
|
||||||
<div>{{ _event.owner.label }}</div>
|
<div>{{ _event.owner?.label }}</div>
|
||||||
<div class="text-ink-gray-5">{{ __('Organizer') }}</div>
|
<div class="text-ink-gray-5">{{ __('Organizer') }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<UserAvatar :user="_event.owner.value" class="-ml-1 !size-5" />
|
<UserAvatar :user="_event.owner?.value" class="-ml-1 !size-5" />
|
||||||
</template>
|
</template>
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
@ -471,6 +471,10 @@ function fetchEvent() {
|
|||||||
} else {
|
} else {
|
||||||
_event.value = event.value
|
_event.value = event.value
|
||||||
oldEvent.value = { ...event.value }
|
oldEvent.value = { ...event.value }
|
||||||
|
|
||||||
|
if (event.value.id === 'duplicate-event') {
|
||||||
|
_event.value.title = _event.value.title + ' (Copy)'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
showAllParticipants.value = false
|
showAllParticipants.value = false
|
||||||
}
|
}
|
||||||
@ -539,6 +543,7 @@ function saveEvent() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
oldEvent.value = { ..._event.value }
|
oldEvent.value = { ..._event.value }
|
||||||
|
sync()
|
||||||
emit('save', _event.value)
|
emit('save', _event.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -576,12 +581,10 @@ function close() {
|
|||||||
if (dirty.value) {
|
if (dirty.value) {
|
||||||
showDiscardChangesModal(() => {
|
showDiscardChangesModal(() => {
|
||||||
reset()
|
reset()
|
||||||
if (_event.value.id === 'new-event') _close()
|
if (['new-event', 'duplicate-event'].includes(_event.value.id)) _close()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
if (_event.value.id === 'duplicate-event')
|
_close()
|
||||||
showDiscardChangesModal(() => _close())
|
|
||||||
else _close()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,6 +699,13 @@ function keydownHandler(e) {
|
|||||||
if (!['details', 'edit'].includes(props.mode)) return
|
if (!['details', 'edit'].includes(props.mode)) return
|
||||||
if (isTypingEvent(e)) return
|
if (isTypingEvent(e)) return
|
||||||
|
|
||||||
|
// Enter in details mode -> switch to edit
|
||||||
|
if (e.key === 'Enter' && props.mode === 'details') {
|
||||||
|
e.preventDefault()
|
||||||
|
editDetails()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Delete (no modifier) -> delete event
|
// Delete (no modifier) -> delete event
|
||||||
if (e.key === 'Delete' || e.key === 'Backspace') {
|
if (e.key === 'Delete' || e.key === 'Backspace') {
|
||||||
// Avoid capturing Backspace if it would navigate away when no focus
|
// Avoid capturing Backspace if it would navigate away when no focus
|
||||||
|
|||||||
@ -379,7 +379,7 @@ function buildTempEvent(e, duplicate) {
|
|||||||
const id = duplicate ? 'duplicate-event' : 'new-event'
|
const id = duplicate ? 'duplicate-event' : 'new-event'
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
title: duplicate ? `${e.title} (Copy)` : '',
|
title: e.title,
|
||||||
description: e.description || '',
|
description: e.description || '',
|
||||||
date: e.fromDate,
|
date: e.fromDate,
|
||||||
fromDate: e.fromDate,
|
fromDate: e.fromDate,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user