From 5f9a4d9c138fe08d8c0b8781ce3be51ab3b3b718 Mon Sep 17 00:00:00 2001 From: dartcafe Date: Wed, 8 Oct 2025 23:21:41 +0200 Subject: [PATCH 1/3] Add poll configuration for forced initial view mode Signed-off-by: dartcafe --- lib/Db/Poll.php | 10 +++++ .../Configuration/ConfigForceViewMode.vue | 38 +++++++++++++++++++ .../SideBar/SideBarTabConfiguration.vue | 16 ++++++++ src/stores/poll.ts | 1 + src/stores/poll.types.ts | 1 + 5 files changed, 66 insertions(+) create mode 100644 src/components/Configuration/ConfigForceViewMode.vue diff --git a/lib/Db/Poll.php b/lib/Db/Poll.php index da7df0ae2a..4f88742313 100644 --- a/lib/Db/Poll.php +++ b/lib/Db/Poll.php @@ -257,6 +257,7 @@ public function getConfigurationArray(): array { 'description' => $this->getDescription(), 'expire' => $this->getExpire(), 'forceConfidentialComments' => $this->getForceConfidentialComments(), + 'forcedDisplayMode' => $this->getForcedDisplayMode(), 'hideBookedUp' => boolval($this->getHideBookedUp()), 'maxVotesPerOption' => $this->getOptionLimit(), 'maxVotesPerUser' => $this->getVoteLimit(), @@ -328,6 +329,7 @@ public function deserializeArray(array $pollConfiguration): self { $this->setHideBookedUp($pollConfiguration['hideBookedUp'] ?? $this->getHideBookedUp()); $this->setProposalsExpire($pollConfiguration['proposalsExpire'] ?? $this->getProposalsExpire()); $this->setShowResults($pollConfiguration['showResults'] ?? $this->getShowResults()); + $this->setForcedDisplayMode($pollConfiguration['forcedDisplayMode'] ?? $this->getForcedDisplayMode()); $this->setUseNo($pollConfiguration['useNo'] ?? $this->getUseNo()); $this->setOptionLimit($pollConfiguration['maxVotesPerOption'] ?? $this->getOptionLimit()); $this->setVoteLimit($pollConfiguration['maxVotesPerUser'] ?? $this->getVoteLimit()); @@ -421,6 +423,14 @@ public function getForceConfidentialComments(): bool { return $this->getMiscSettingsArray()['forceConfidentialComments'] ?? false; } + private function setForcedDisplayMode(string $value): void { + $this->setMiscSettingsByKey('forcedDisplayMode', $value); + } + + public function getForcedDisplayMode(): string { + return $this->getMiscSettingsArray()['forcedDisplayMode'] ?? 'user-pref'; + } + private function setCollapseDescription(bool|int $value): void { $this->setMiscSettingsByKey('collapseDescription', (bool)$value); } diff --git a/src/components/Configuration/ConfigForceViewMode.vue b/src/components/Configuration/ConfigForceViewMode.vue new file mode 100644 index 0000000000..b378cb4b5d --- /dev/null +++ b/src/components/Configuration/ConfigForceViewMode.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/src/components/SideBar/SideBarTabConfiguration.vue b/src/components/SideBar/SideBarTabConfiguration.vue index 5fa005110f..fefa4d4cc7 100644 --- a/src/components/SideBar/SideBarTabConfiguration.vue +++ b/src/components/SideBar/SideBarTabConfiguration.vue @@ -14,7 +14,10 @@ import LockedIcon from 'vue-material-design-icons/LockOutline.vue' import UnlockedIcon from 'vue-material-design-icons/LockOpenVariantOutline.vue' import ShowResultsIcon from 'vue-material-design-icons/Monitor.vue' import HideResultsUntilClosedIcon from 'vue-material-design-icons/MonitorLock.vue' +import UserPreferenceIcon from 'vue-material-design-icons/AccountCogOutline.vue' import ShowResultsNeverIcon from 'vue-material-design-icons/MonitorOff.vue' +import ListViewIcon from 'vue-material-design-icons/ViewListOutline.vue' +import TableViewIcon from 'vue-material-design-icons/Table.vue' import CardDiv from '../Base/modules/CardDiv.vue' import ConfigBox from '../Base/modules/ConfigBox.vue' @@ -32,6 +35,7 @@ import ConfigVoteLimit from '../Configuration/ConfigVoteLimit.vue' import { usePollStore } from '../../stores/poll' import { useVotesStore } from '../../stores/votes' import ConfigDangerArea from '../Configuration/ConfigDangerArea.vue' +import ConfigForceViewMode from '../Configuration/ConfigForceViewMode.vue' const pollStore = usePollStore() const votesStore = useVotesStore() @@ -95,6 +99,18 @@ const votesStore = useVotesStore() + + + + +