X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fproblems.js;h=53077049d12dc61bd071fa2160e38c67c86cba08;hp=558f0bada06f9099d41ed895d76882c05c9561bd;hb=fd08ab2c5b8931bb8c95cf7e9f2f95122647f991;hpb=26b8e4f7c71030d49e44fe1d89632ef91b886d67
diff --git a/public/javascripts/components/problems.js b/public/javascripts/components/problems.js
index 558f0bad..53077049 100644
--- a/public/javascripts/components/problems.js
+++ b/public/javascripts/components/problems.js
@@ -1,229 +1,316 @@
Vue.component('my-problems', {
data: function () {
return {
+ userId: user.id,
problems: [], //oldest first
- myProblems: [], //same
- curIdx: 0, //index in problems array
- stage: "nothing", //or "preview" after new problem is filled
- newProblem: {
+ myProblems: [], //same, but only mine
+ singletons: [], //requested problems (using #num)
+ display: "others", //or "mine"
+ curProb: null, //(reference to) current displayed problem (if any)
+ showSolution: false,
+ pbNum: 0, //to navigate directly to some problem
+ // New problem (to upload), or existing problem to edit:
+ modalProb: {
+ id: 0, //defined if it's an edit
fen: "",
instructions: "",
solution: "",
+ preview: false,
},
};
},
template: `
-
-
-
-
-board qui bouge et activé que si #hash donnant numéro du problème
-deux listes : tous les problèmes sauf les miens
- + les miens
-
-
-//TODO: filter "my problems" ==> liste séparée (lors de la requête serveur)
---> bouton plutôt sous l'échiquier après soluce (sauf si anonymous)
---> puis dans la vue "my problems (listing échiquier gauche / instrus + soluce cachée à droite
-if (this.mode == "problem")
- {
- // Show problem instructions
- elementArray.push(
- h('div',
- {
- attrs: { id: "instructions-div" },
- "class": {
- "clearer": true,
- "section-content": true,
- },
- },
- [
- h('p',
- {
- attrs: { id: "problem-instructions" },
- domProps: { innerHTML: this.problem.instructions }
- }
- )
- ]
- )
- );
- }
-
-
- // TODO ici :: instrus + diag interactif + solution
- my-board + pilotage via movesList + VariantRules !
-
-
+
+
+
+ {{ curProb.instructions }}
+
+
+
+
+
+
+ {{ translations["Show solution"] }}
+
+
+ {{ curProb.solution }}
+
+
+
+ Back to list display
+
+
+
+
+
+ Show problem
+
+
+
+ My problems (only)
+
+
- if (this.mode == "problem")
- {
- // Show problem solution (on click)
- elementArray.push(
- h('div',
- {
- attrs: { id: "solution-div" },
- "class": { "section-content": true },
- },
- [
- h('h3',
- {
- "class": { clickable: true },
- domProps: { innerHTML: translations["Show solution"] },
- on: { click: this.toggleShowSolution },
- }
- ),
- h('p',
- {
- attrs: { id: "problem-solution" },
- domProps: { innerHTML: this.problem.solution }
- }
- )
- ]
- )
- );
- }
-
-
-