Skip to content

Commit 1133211

Browse files
author
philippe lhardy
committed
variant creation selection is disabled by default
To be able to select variant in poll creation option should be checked within user settings allow to have this experimental functionality without impacting classical use Signed-off-by: philippe lhardy <philippe.lhardy@astrolabe.coop>
1 parent 35a9555 commit 1133211

4 files changed

Lines changed: 26 additions & 1 deletion

File tree

src/components/Create/PollCreateDlg.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ import RadioGroupDiv from '../Base/modules/RadioGroupDiv.vue'
1717
import ConfigBox from '../Base/modules/ConfigBox.vue'
1818
1919
import { pollTypes, usePollStore, votingVariants } from '../../stores/poll'
20+
import { usePreferencesStore } from '../../stores/preferences'
2021
import { showError, showSuccess } from '@nextcloud/dialogs'
2122
2223
import type { PollType, VotingVariant } from '../../stores/poll.types'
2324
2425
const pollStore = usePollStore()
26+
const preferencesStore = usePreferencesStore()
2527
2628
const emit = defineEmits<{
2729
(e: 'close'): void
@@ -118,7 +120,7 @@ function resetPoll() {
118120
<RadioGroupDiv v-model="pollType" :options="pollTypeOptions" />
119121
</ConfigBox>
120122

121-
<ConfigBox :name="t('polls', 'Vote variant')">
123+
<ConfigBox v-if="preferencesStore.user.variantsCreation" :name="t('polls', 'Vote variant')">
122124
<template #icon>
123125
<CheckIcon />
124126
</template>

src/components/Settings/UserSettings/FeatureSettings.vue

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const defaultViewDatePoll = computed({
3535
: 'table-view'
3636
},
3737
})
38+
3839
</script>
3940

4041
<template>
@@ -104,5 +105,24 @@ const defaultViewDatePoll = computed({
104105
"
105106
@change="preferencesStore.write()" />
106107
</div>
108+
109+
<div class="user_settings">
110+
<NcCheckboxRadioSwitch
111+
v-model="preferencesStore.user.variantsCreation"
112+
type="switch"
113+
@update:model-value="preferencesStore.write()">
114+
{{ t('polls', 'Variant creation') }}
115+
</NcCheckboxRadioSwitch>
116+
<div class="settings_details">
117+
{{
118+
t(
119+
'polls',
120+
'Check this to allow variants polls creation.',
121+
)
122+
}}
123+
</div>
124+
</div>
125+
126+
107127
</div>
108128
</template>

src/stores/preferences.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const usePreferencesStore = defineStore('preferences', {
2727
useCommentsAlternativeStyling: false,
2828
useAlternativeStyling: false,
2929
verbosePollsList: false,
30+
variantCreation: false,
3031
},
3132
availableCalendars: [],
3233
}),

src/stores/preferences.types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export type UserPreferences = {
1919
useCommentsAlternativeStyling: boolean
2020
useAlternativeStyling: boolean
2121
verbosePollsList: boolean
22+
variantsCreation: boolean
23+
2224
}
2325

2426
export type Calendar = {

0 commit comments

Comments
 (0)