Rename resultsRequireVoteField
authorCyperghost <olaf_schmitz_1@t-online.de>
Wed, 17 Jan 2024 10:53:13 +0000 (11:53 +0100)
committerOlaf Braun <info@braun-development.de>
Thu, 7 Mar 2024 15:36:30 +0000 (16:36 +0100)
ts/WoltLabSuite/Core/Ui/Poll/Editor.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Poll/Editor.js

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