Skip to content

Commit de03a76

Browse files
authored
Merge pull request #4280 from nextcloud/fix/sort-options
Fix option sorting
2 parents 3ab40ab + bcfb34a commit de03a76

4 files changed

Lines changed: 31 additions & 67 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
# Changelog
66
All notable changes to this project will be documented in this file.
77

8-
## [8.4.5] 2025-09-04
9-
### KNOWN BUGS
10-
- Reorderung of options of a textpoll is broken
8+
## [8.4.6] - tbd
9+
### Fixed
10+
- Ordering options in text polls was broken
11+
- Menu showed invalid actions in text poll
1112

13+
## [8.4.5] - 2025-09-04
1214
### Fixed
1315
- Fixed display of one day event on days with a daylight saving change
1416

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: 6 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,11 @@ import { nextTick, useTemplateRef } from 'vue'
88
import { useSortable } from '@vueuse/integrations/useSortable'
99
1010
import { t } from '@nextcloud/l10n'
11-
import NcEmptyContent from '@nextcloud/vue/components/NcEmptyContent'
12-
import NcActions from '@nextcloud/vue/components/NcActions'
13-
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
14-
15-
import DeleteIcon from 'vue-material-design-icons/TrashCanOutline.vue'
16-
import RestoreIcon from 'vue-material-design-icons/RecycleVariant.vue'
17-
import TextPollIcon from 'vue-material-design-icons/FormatListBulletedSquare.vue'
18-
import ConfirmIcon from 'vue-material-design-icons/CheckboxBlankOutline.vue'
19-
import UnconfirmIcon from 'vue-material-design-icons/CheckboxMarkedOutline.vue'
2011
2112
import OptionItem from './OptionItem.vue'
22-
import OptionsTextAdd from './OptionsTextAdd.vue'
2313
import { usePollStore } from '../../stores/poll'
2414
import { useOptionsStore } from '../../stores/options'
15+
import OptionMenu from './OptionMenu.vue'
2516
2617
const pollStore = usePollStore()
2718
const optionsStore = useOptionsStore()
@@ -60,8 +51,7 @@ function onSort(event: { oldIndex: number; newIndex: number }) {
6051
</script>
6152

6253
<template>
63-
<OptionsTextAdd v-if="!pollStore.isClosed" />
64-
<div v-if="optionsStore.options.length" ref="list" :style="cssVar">
54+
<div ref="list" :style="cssVar">
6555
<div
6656
v-for="option in optionsStore.options"
6757
:key="option.id"
@@ -71,59 +61,14 @@ function onSort(event: { oldIndex: number; newIndex: number }) {
7161
:option="option"
7262
:draggable="true"
7363
show-owner>
74-
<template v-if="pollStore.permissions.edit" #actions>
75-
<NcActions v-if="!pollStore.isClosed" class="action">
76-
<NcActionButton
77-
v-if="!option.deleted"
78-
:name="t('polls', 'Delete option')"
79-
:aria-label="t('polls', 'Delete option')"
80-
@click="optionsStore.delete({ option })">
81-
<template #icon>
82-
<DeleteIcon />
83-
</template>
84-
</NcActionButton>
85-
<NcActionButton
86-
v-if="option.deleted"
87-
:name="t('polls', 'Restore option')"
88-
:aria-label="t('polls', 'Restore option')"
89-
@click="optionsStore.restore({ option })">
90-
<template #icon>
91-
<RestoreIcon />
92-
</template>
93-
</NcActionButton>
94-
<NcActionButton
95-
v-if="!option.deleted && !pollStore.isClosed"
96-
:name="
97-
option.confirmed
98-
? t('polls', 'Unconfirm option')
99-
: t('polls', 'Confirm option')
100-
"
101-
:aria-label="
102-
option.confirmed
103-
? t('polls', 'Unconfirm option')
104-
: t('polls', 'Confirm option')
105-
"
106-
type="tertiary"
107-
@click="optionsStore.confirm({ option })">
108-
<template #icon>
109-
<UnconfirmIcon v-if="option.confirmed" />
110-
<ConfirmIcon v-else />
111-
</template>
112-
</NcActionButton>
113-
</NcActions>
64+
<template #actions>
65+
<OptionMenu
66+
v-if="pollStore.permissions.edit || option.isOwner"
67+
:option="option" />
11468
</template>
11569
</OptionItem>
11670
</div>
11771
</div>
118-
119-
<NcEmptyContent
120-
v-else
121-
:name="t('polls', 'No vote options')"
122-
:description="t('polls', 'Add some!')">
123-
<template #icon>
124-
<TextPollIcon />
125-
</template>
126-
</NcEmptyContent>
12772
</template>
12873

12974
<style lang="scss">

src/components/SideBar/SideBarTabOptions.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import TextOptionsIcon from 'vue-material-design-icons/FormatListBulletedSquare.
2323
import OptionsTextAddBulk from '../Options/OptionsTextAddBulk.vue'
2424
import ActionAddOption from '../Actions/modules/ActionAddOption.vue'
2525
import { Event } from '../../Types'
26+
import OptionsTextAdd from '../Options/OptionsTextAdd.vue'
27+
import { NcEmptyContent } from '@nextcloud/vue'
2628
2729
const optionsStore = useOptionsStore()
2830
const pollStore = usePollStore()
@@ -100,7 +102,18 @@ onUnmounted(() => {
100102
<TextOptionsIcon />
101103
</template>
102104

103-
<OptionsText />
105+
<OptionsTextAdd v-if="!pollStore.isClosed" />
106+
107+
<OptionsText v-if="optionsStore.options.length" />
108+
109+
<NcEmptyContent
110+
v-else
111+
:name="t('polls', 'No vote options')"
112+
:description="t('polls', 'Add some!')">
113+
<template #icon>
114+
<TextOptionsIcon />
115+
</template>
116+
</NcEmptyContent>
104117

105118
<template #actions>
106119
<OptionsTextAddBulk v-if="!pollStore.isClosed" />

0 commit comments

Comments
 (0)