Skip to content

Commit 2f2bc9b

Browse files
committed
fix OptionMenu and apply to OptionItems in text polls
Signed-off-by: dartcafe <github@dartcafe.de>
1 parent 7283bc3 commit 2f2bc9b

2 files changed

Lines changed: 11 additions & 49 deletions

File tree

src/components/Options/OptionMenu.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ const confirmAllowed = computed(
4949
() => !option.deleted && pollStore.isClosed && pollStore.permissions.edit,
5050
)
5151
const cloneAllowed = computed(
52-
() => !option.deleted && !pollStore.isClosed && pollStore.permissions.edit,
52+
() =>
53+
pollStore.type === 'datePoll'
54+
&& !option.deleted
55+
&& !pollStore.isClosed
56+
&& pollStore.permissions.edit,
5357
)
5458
5559
/**
@@ -124,7 +128,7 @@ function confirmOption() {
124128
<NcActionButton
125129
v-if="useSort && pollStore.permissions.edit"
126130
close-after-click
127-
:name="t('polls', 'Sort')"
131+
:name="t('polls', 'Sort by answers of this option')"
128132
@click="votesStore.setSort({ optionId: option.id })">
129133
<template #icon>
130134
<OptionSortIcon />

src/components/Options/OptionsText.vue

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,11 @@ import { nextTick, useTemplateRef } from 'vue'
88
import { useSortable } from '@vueuse/integrations/useSortable'
99
1010
import { t } from '@nextcloud/l10n'
11-
import NcActions from '@nextcloud/vue/components/NcActions'
12-
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
13-
14-
import DeleteIcon from 'vue-material-design-icons/TrashCanOutline.vue'
15-
import RestoreIcon from 'vue-material-design-icons/RecycleVariant.vue'
16-
import ConfirmIcon from 'vue-material-design-icons/CheckboxBlankOutline.vue'
17-
import UnconfirmIcon from 'vue-material-design-icons/CheckboxMarkedOutline.vue'
1811
1912
import OptionItem from './OptionItem.vue'
2013
import { usePollStore } from '../../stores/poll'
2114
import { useOptionsStore } from '../../stores/options'
15+
import OptionMenu from './OptionMenu.vue'
2216
2317
const pollStore = usePollStore()
2418
const optionsStore = useOptionsStore()
@@ -67,46 +61,10 @@ function onSort(event: { oldIndex: number; newIndex: number }) {
6761
:option="option"
6862
:draggable="true"
6963
show-owner>
70-
<template v-if="pollStore.permissions.edit" #actions>
71-
<NcActions v-if="!pollStore.isClosed" class="action">
72-
<NcActionButton
73-
v-if="!option.deleted"
74-
:name="t('polls', 'Delete option')"
75-
:aria-label="t('polls', 'Delete option')"
76-
@click="optionsStore.delete({ option })">
77-
<template #icon>
78-
<DeleteIcon />
79-
</template>
80-
</NcActionButton>
81-
<NcActionButton
82-
v-if="option.deleted"
83-
:name="t('polls', 'Restore option')"
84-
:aria-label="t('polls', 'Restore option')"
85-
@click="optionsStore.restore({ option })">
86-
<template #icon>
87-
<RestoreIcon />
88-
</template>
89-
</NcActionButton>
90-
<NcActionButton
91-
v-if="!option.deleted && !pollStore.isClosed"
92-
:name="
93-
option.confirmed
94-
? t('polls', 'Unconfirm option')
95-
: t('polls', 'Confirm option')
96-
"
97-
:aria-label="
98-
option.confirmed
99-
? t('polls', 'Unconfirm option')
100-
: t('polls', 'Confirm option')
101-
"
102-
type="tertiary"
103-
@click="optionsStore.confirm({ option })">
104-
<template #icon>
105-
<UnconfirmIcon v-if="option.confirmed" />
106-
<ConfirmIcon v-else />
107-
</template>
108-
</NcActionButton>
109-
</NcActions>
64+
<template #actions>
65+
<OptionMenu
66+
v-if="pollStore.permissions.edit || option.isOwner"
67+
:option="option" />
11068
</template>
11169
</OptionItem>
11270
</div>

0 commit comments

Comments
 (0)