Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2021-05-19 22:31:33 +0300
committerdartcafe <github@dartcafe.de>2021-05-19 22:31:33 +0300
commitaee209e115cf8e2a9aff20bd620f749d322d4ecd (patch)
tree11d37c730700cbfcd59bf44d64a55f2c8c0d7e67 /src
parent23e365f39dde884866d810f86c058bc00e4d6223 (diff)
Option to hadle no as unvoted
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'src')
-rw-r--r--src/js/components/Configuration/ConfigUseNo.vue61
-rw-r--r--src/js/components/SideBar/SideBarTabConfiguration.vue29
-rw-r--r--src/js/store/modules/poll.js7
3 files changed, 81 insertions, 16 deletions
diff --git a/src/js/components/Configuration/ConfigUseNo.vue b/src/js/components/Configuration/ConfigUseNo.vue
new file mode 100644
index 00000000..3cfee72f
--- /dev/null
+++ b/src/js/components/Configuration/ConfigUseNo.vue
@@ -0,0 +1,61 @@
+<!--
+ - @copyright Copyright (c) 2021 René Gieling <github@dartcafe.de>
+ -
+ - @author René Gieling <github@dartcafe.de>
+ -
+ - @license GNU AGPL version 3 or any later version
+ -
+ - This program is free software: you can redistribute it and/or modify
+ - it under the terms of the GNU Affero General Public License as
+ - published by the Free Software Foundation, either version 3 of the
+ - License, or (at your option) any later version.
+ -
+ - This program is distributed in the hope that it will be useful,
+ - but WITHOUT ANY WARRANTY; without even the implied warranty of
+ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ - GNU Affero General Public License for more details.
+ -
+ - You should have received a copy of the GNU Affero General Public License
+ - along with this program. If not, see <http://www.gnu.org/licenses/>.
+ -
+ -->
+
+<template>
+ <CheckBoxDiv v-model="useNo" :label="label" />
+</template>
+
+<script>
+import { mapState } from 'vuex'
+import CheckBoxDiv from '../Base/CheckBoxDiv'
+
+export default {
+ name: 'ConfigUseNo',
+
+ components: {
+ CheckBoxDiv,
+ },
+
+ data() {
+ return {
+ label: t('polls', 'Delete vote when switched to "no"'),
+ }
+ },
+
+ computed: {
+ ...mapState({
+ poll: (state) => state.poll,
+ }),
+
+ useNo: {
+ get() {
+ return !this.poll.useNo
+ },
+ set(value) {
+ this.$store.commit('poll/setProperty', { useNo: +(!value) })
+ this.$emit('change')
+ },
+ },
+
+ },
+}
+</script>
diff --git a/src/js/components/SideBar/SideBarTabConfiguration.vue b/src/js/components/SideBar/SideBarTabConfiguration.vue
index 3a028ac5..6775d787 100644
--- a/src/js/components/SideBar/SideBarTabConfiguration.vue
+++ b/src/js/components/SideBar/SideBarTabConfiguration.vue
@@ -39,6 +39,7 @@
<ConfigBox :title="t('polls', 'Poll configurations')" icon-class="icon-category-customization">
<ConfigAllowComment @change="writePoll" />
<ConfigAllowMayBe @change="writePoll" />
+ <ConfigUseNo @change="writePoll" />
<ConfigAnonymous @change="writePoll" />
<ConfigVoteLimit @change="writePoll" />
@@ -75,34 +76,36 @@ import { mapGetters, mapState } from 'vuex'
import { showSuccess, showError } from '@nextcloud/dialogs'
import moment from '@nextcloud/moment'
import ConfigBox from '../Base/ConfigBox'
-import ConfigDescription from '../Configuration/ConfigDescription'
-import ConfigTitle from '../Configuration/ConfigTitle'
+import ConfigAccess from '../Configuration/ConfigAccess'
+import ConfigAdminAccess from '../Configuration/ConfigAdminAccess'
import ConfigAllowComment from '../Configuration/ConfigAllowComment'
-import ConfigAnonymous from '../Configuration/ConfigAnonymous'
import ConfigAllowMayBe from '../Configuration/ConfigAllowMayBe'
-import ConfigAdminAccess from '../Configuration/ConfigAdminAccess'
-import ConfigVoteLimit from '../Configuration/ConfigVoteLimit'
-import ConfigOptionLimit from '../Configuration/ConfigOptionLimit'
+import ConfigAnonymous from '../Configuration/ConfigAnonymous'
import ConfigClosing from '../Configuration/ConfigClosing'
-import ConfigAccess from '../Configuration/ConfigAccess'
+import ConfigDescription from '../Configuration/ConfigDescription'
+import ConfigOptionLimit from '../Configuration/ConfigOptionLimit'
import ConfigShowResults from '../Configuration/ConfigShowResults'
+import ConfigTitle from '../Configuration/ConfigTitle'
+import ConfigUseNo from '../Configuration/ConfigUseNo'
+import ConfigVoteLimit from '../Configuration/ConfigVoteLimit'
export default {
name: 'SideBarTabConfiguration',
components: {
ConfigBox,
- ConfigDescription,
- ConfigTitle,
+ ConfigAccess,
+ ConfigAdminAccess,
ConfigAllowComment,
ConfigAllowMayBe,
ConfigAnonymous,
- ConfigAdminAccess,
- ConfigVoteLimit,
- ConfigOptionLimit,
ConfigClosing,
- ConfigAccess,
+ ConfigDescription,
+ ConfigOptionLimit,
ConfigShowResults,
+ ConfigTitle,
+ ConfigUseNo,
+ ConfigVoteLimit,
},
computed: {
diff --git a/src/js/store/modules/poll.js b/src/js/store/modules/poll.js
index 2528ba74..7e1edd78 100644
--- a/src/js/store/modules/poll.js
+++ b/src/js/store/modules/poll.js
@@ -85,11 +85,12 @@ const getters = {
},
- answerSequence: (state) => {
+ answerSequence: (state, getters, rootState) => {
+ const noString = rootState.poll.useNo ? 'no' : ''
if (state.allowMaybe) {
- return ['no', 'yes', 'maybe']
+ return [noString, 'yes', 'maybe']
}
- return ['no', 'yes']
+ return [noString, 'yes']
},