From f37790f7fe26c7b3bf704781249945ef7e3199da Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Thu, 20 Feb 2020 23:57:35 +0100 Subject: [PATCH] Always reset curproblem before showing modal --- client/src/views/Problems.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 = ""; -- 2.44.0