From: Benjamin Auder Date: Thu, 20 Feb 2020 22:57:35 +0000 (+0100) Subject: Always reset curproblem before showing modal X-Git-Url: https://git.auder.net/variants/Chakart/pieces/img/current/git-logo.png?a=commitdiff_plain;h=f37790f7fe26c7b3bf704781249945ef7e3199da;p=vchess.git Always reset curproblem before showing modal --- diff --git a/client/src/views/Problems.vue b/client/src/views/Problems.vue index 7321fbbd..9a729335 100644 --- a/client/src/views/Problems.vue +++ b/client/src/views/Problems.vue @@ -72,7 +72,7 @@ main .row(v-else) .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2 #controls - button#newProblem(onClick="window.doClick('modalNewprob')") + button#newProblem(@click="prepareNewProblem()") | {{ st.tr["New problem"] }} label(for="checkboxMine") {{ st.tr["My problems"] }} input#checkboxMine( @@ -292,6 +292,10 @@ export default { this.showOne = true; }); }, + prepareNewProblem: function() { + this.resetCurProb(); + window.doClick("modalNewprob"); + }, sendProblem: function() { const error = checkProblem(this.curproblem); if (error) { @@ -311,13 +315,11 @@ export default { this.showProblem(editedP); } else { - // New problem let newProblem = Object.assign({}, this.curproblem); newProblem.id = ret.id; newProblem.uid = this.st.user.id; newProblem.uname = this.st.user.name; this.problems = [newProblem].concat(this.problems); - this.resetCurProb(); } document.getElementById("modalNewprob").checked = false; this.infoMsg = "";