Revert "Rename resultsRequireVoteField"
authorCyperghost <olaf_schmitz_1@t-online.de>
Wed, 17 Jan 2024 14:29:24 +0000 (15:29 +0100)
committerOlaf Braun <info@braun-development.de>
Thu, 7 Mar 2024 15:36:30 +0000 (16:36 +0100)
This reverts commit c56309ed91f2d04d7a0eee56a33ea2d019eb5551.

ts/WoltLabSuite/Core/Ui/Poll/Editor.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Poll/Editor.js

index bba4f8277163223bec02ba1b77e4a9439b3393fa..c59dcf7f5642120f80c76379bf5bcb431e3aadf0 100644 (file)
@@ -64,7 +64,8 @@ class UiPollEditor {
   private readonly options: UiPollEditorOptions;
   private readonly optionList: HTMLOListElement;
   private readonly questionField: HTMLInputElement;
-  private readonly resultsRequireVoteField: HTMLInputElement;
+  private readonly resultsRequireVoteNoField: HTMLInputElement | null;
+  private readonly resultsRequireVoteYesField: HTMLInputElement;
   private readonly sortByVotesField: HTMLInputElement;
   private readonly wysiwygId: string;
 
@@ -92,9 +93,12 @@ class UiPollEditor {
     this.maxVotesField = document.getElementById(this.wysiwygId + "Poll_maxVotes") as HTMLInputElement;
     this.isChangeableYesField = document.getElementById(this.wysiwygId + "Poll_isChangeable") as HTMLInputElement;
     this.isPublicField = document.getElementById(this.wysiwygId + "Poll_isPublic") as HTMLInputElement;
-    this.resultsRequireVoteField = document.getElementById(
+    this.resultsRequireVoteYesField = document.getElementById(
       this.wysiwygId + "Poll_resultsRequireVote",
     ) as HTMLInputElement;
+    this.resultsRequireVoteNoField = document.getElementById(
+      this.wysiwygId + "Poll_resultsRequireVote_no",
+    ) as HTMLInputElement;
     this.sortByVotesField = document.getElementById(this.wysiwygId + "Poll_sortByVotes") as HTMLInputElement;
 
     this.optionCount = 0;
@@ -296,7 +300,8 @@ class UiPollEditor {
     this.maxVotesField.value = "1";
     this.isChangeableYesField.checked = false;
     this.isPublicField.checked = false;
-    this.resultsRequireVoteField.checked = false;
+    this.resultsRequireVoteYesField.checked = false;
+    if (this.resultsRequireVoteNoField) this.resultsRequireVoteNoField.checked = true;
     this.sortByVotesField.checked = false;
 
     EventHandler.fire("com.woltlab.wcf.poll.editor", "reset", {
@@ -338,7 +343,7 @@ class UiPollEditor {
       data.pollIsChangeable = true;
     }
 
-    if (this.resultsRequireVoteField.checked) {
+    if (this.resultsRequireVoteYesField.checked) {
       data.pollResultsRequireVote = true;
     }
 
@@ -401,7 +406,7 @@ class UiPollEditor {
       [this.maxVotesField.id]: this.maxVotesField.value,
       [this.isChangeableYesField.id]: !!this.isChangeableYesField.checked,
       [this.isPublicField.id]: !!this.isPublicField.checked,
-      [this.resultsRequireVoteField.id]: !!this.resultsRequireVoteField.checked,
+      [this.resultsRequireVoteYesField.id]: !!this.resultsRequireVoteYesField.checked,
       [this.sortByVotesField.id]: !!this.sortByVotesField.checked,
     };
   }
index 896196bec879e023986e2ecec913a14b93e74682..0b11bff28c9fb0a0d70e7f899f99b048f91f1110 100644 (file)
@@ -23,7 +23,8 @@ define(["require", "exports", "tslib", "../../Core", "../../Language", "../Sorta
         options;
         optionList;
         questionField;
-        resultsRequireVoteField;
+        resultsRequireVoteNoField;
+        resultsRequireVoteYesField;
         sortByVotesField;
         wysiwygId;
         constructor(containerId, pollOptions, wysiwygId, options) {
@@ -46,7 +47,8 @@ define(["require", "exports", "tslib", "../../Core", "../../Language", "../Sorta
             this.maxVotesField = document.getElementById(this.wysiwygId + "Poll_maxVotes");
             this.isChangeableYesField = document.getElementById(this.wysiwygId + "Poll_isChangeable");
             this.isPublicField = document.getElementById(this.wysiwygId + "Poll_isPublic");
-            this.resultsRequireVoteField = document.getElementById(this.wysiwygId + "Poll_resultsRequireVote");
+            this.resultsRequireVoteYesField = document.getElementById(this.wysiwygId + "Poll_resultsRequireVote");
+            this.resultsRequireVoteNoField = document.getElementById(this.wysiwygId + "Poll_resultsRequireVote_no");
             this.sortByVotesField = document.getElementById(this.wysiwygId + "Poll_sortByVotes");
             this.optionCount = 0;
             this.options = Core.extend({
@@ -212,7 +214,9 @@ define(["require", "exports", "tslib", "../../Core", "../../Language", "../Sorta
             this.maxVotesField.value = "1";
             this.isChangeableYesField.checked = false;
             this.isPublicField.checked = false;
-            this.resultsRequireVoteField.checked = false;
+            this.resultsRequireVoteYesField.checked = false;
+            if (this.resultsRequireVoteNoField)
+                this.resultsRequireVoteNoField.checked = true;
             this.sortByVotesField.checked = false;
             EventHandler.fire("com.woltlab.wcf.poll.editor", "reset", {
                 pollEditor: this,
@@ -249,7 +253,7 @@ define(["require", "exports", "tslib", "../../Core", "../../Language", "../Sorta
             if (this.isChangeableYesField.checked) {
                 data.pollIsChangeable = true;
             }
-            if (this.resultsRequireVoteField.checked) {
+            if (this.resultsRequireVoteYesField.checked) {
                 data.pollResultsRequireVote = true;
             }
             if (this.sortByVotesField.checked) {
@@ -305,7 +309,7 @@ define(["require", "exports", "tslib", "../../Core", "../../Language", "../Sorta
                 [this.maxVotesField.id]: this.maxVotesField.value,
                 [this.isChangeableYesField.id]: !!this.isChangeableYesField.checked,
                 [this.isPublicField.id]: !!this.isPublicField.checked,
-                [this.resultsRequireVoteField.id]: !!this.resultsRequireVoteField.checked,
+                [this.resultsRequireVoteYesField.id]: !!this.resultsRequireVoteYesField.checked,
                 [this.sortByVotesField.id]: !!this.sortByVotesField.checked,
             };
         }