@@ -8,20 +8,11 @@ import { nextTick, useTemplateRef } from 'vue'
88import { useSortable } from ' @vueuse/integrations/useSortable'
99
1010import { 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
2112import OptionItem from ' ./OptionItem.vue'
22- import OptionsTextAdd from ' ./OptionsTextAdd.vue'
2313import { usePollStore } from ' ../../stores/poll'
2414import { useOptionsStore } from ' ../../stores/options'
15+ import OptionMenu from ' ./OptionMenu.vue'
2516
2617const pollStore = usePollStore ()
2718const 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">
0 commit comments