X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fproblems.js;h=558f0bada06f9099d41ed895d76882c05c9561bd;hb=26b8e4f7c71030d49e44fe1d89632ef91b886d67;hp=ad8c54c014148bec9fa063cbd00bacd2328439c5;hpb=81da2786f2f497b4416e0488c34a48fb794c28df;p=vchess.git diff --git a/public/javascripts/components/problems.js b/public/javascripts/components/problems.js index ad8c54c0..558f0bad 100644 --- a/public/javascripts/components/problems.js +++ b/public/javascripts/components/problems.js @@ -2,6 +2,7 @@ Vue.component('my-problems', { data: function () { return { problems: [], //oldest first + myProblems: [], //same curIdx: 0, //index in problems array stage: "nothing", //or "preview" after new problem is filled newProblem: { @@ -30,7 +31,15 @@ Vue.component('my-problems', { - if (this.mode == "problem") +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( @@ -132,6 +141,7 @@ Vue.component('my-problems', { created: function() { // Analyse URL: if a single problem required, show it. Otherwise, // TODO: fetch most recent problems from server + // If the requested problem is in the list, just show it }, methods: { translate: function(text) { @@ -175,7 +185,7 @@ Vue.component('my-problems', { last_dt = this.problems[i].added; } } - ajax("/problems/" + variant, "GET", { + ajax("/problems/" + variant.name, "GET", { //TODO: use variant._id ? direction: direction, last_dt: last_dt, }, response => { @@ -201,7 +211,7 @@ Vue.component('my-problems', { }, sendNewProblem: function() { // Send it to the server and close modal - ajax("/problems/" + variant, "POST", { + ajax("/problems/" + variant.name, "POST", { //TODO: with variant._id ? fen: this.newProblem.fen, instructions: this.newProblem.instructions, solution: this.newProblem.solution, @@ -217,5 +227,3 @@ Vue.component('my-problems', { // TODO: // possibilité de supprimer / éditer si peer ID reconnu comme celui du probleme (champ "uploader") -// --> côté serveur on vérifie un certain "secret" -// --> filtre possible "mes problèmes"