fix(task): show related tasks form with shortcut even when there are already other related tasks
continuous-integration/drone/push Build is passing Details

Resolves https://github.com/go-vikunja/frontend/issues/122
This commit is contained in:
kolaente 2023-08-29 13:57:12 +02:00
parent 47d589002c
commit 5630c90dee
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 15 additions and 1 deletions

View File

@ -9,6 +9,7 @@
variant="secondary"
icon="plus"
:shadow="false"
id="showRelatedTasksFormButton"
/>
<transition-group name="fade">
<template v-if="editEnabled && showCreate">

View File

@ -378,7 +378,7 @@
{{ $t('task.detail.actions.attachments') }}
</x-button>
<x-button
@click="setFieldActive('relatedTasks')"
@click="setRelatedTasksActive()"
variant="secondary"
icon="sitemap"
v-shortcut="'r'"
@ -777,6 +777,19 @@ async function removeRepeatAfter() {
task.value.repeatMode = TASK_REPEAT_MODES.REPEAT_MODE_DEFAULT
await saveTask()
}
function setRelatedTasksActive() {
setFieldActive('relatedTasks')
// If the related tasks are already available, show the form again
const el = activeFieldElements['relatedTasks']
for (const child in el?.children) {
if (el?.children[child]?.id === 'showRelatedTasksFormButton') {
el?.children[child]?.click()
break
}
}
}
</script>
<style lang="scss" scoped>