X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fproblems.js;h=93b3353a8ba12ae769b21b9c273b0a362ca0b2e9;hb=ff1d4c3f43d8333e9629a8e59606c234cb10869f;hp=60aa9c430833caa145aa522d7060a9e6e3a9d91b;hpb=a9f262f38d7ae9ea4c935c549309bd2f773aa6c2;p=vchess.git
diff --git a/public/javascripts/components/problems.js b/public/javascripts/components/problems.js
index 60aa9c43..93b3353a 100644
--- a/public/javascripts/components/problems.js
+++ b/public/javascripts/components/problems.js
@@ -1,11 +1,15 @@
Vue.component('my-problems', {
data: function () {
return {
+ userId: user.id,
problems: [], //oldest first
- myProblems: [], //same
- curProblems: [], //assigned to either of the ones above
- curIdx: 0, //index in (current) problems array
- newProblem: {
+ myProblems: [], //same, but only mine
+ display: "list", //or "myList"
+ curIdx: -1, //index in (current) problems array
+ showSolution: false,
+ // New problem (to upload), or existing problem to edit:
+ modalProb: {
+ id: 0, //defined if it's an edit
fen: "",
instructions: "",
solution: "",
@@ -13,122 +17,70 @@ Vue.component('my-problems', {
},
};
},
+ // TODO: problem edit, just fill modalProb + adjust AJAX call
+ // problem delete: just AJAX call + confirm
template: `
-
- --> OK, mais ces flèches n'ont pas la même action selon les vues
- --> fetchN si liste, problème suivant/précédent sinon
-
-
-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 }}
+
+ Edit
+ Delete
+
+
+
+ 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 }
- }
- )
- ]
- )
- );
- }
-
-