X-Git-Url: https://git.auder.net/pieces/Checkered/cq.svg?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2FproblemSummary.js;h=2c9ea94ef3661ad7f56d49c1c5a6d275712e8eb3;hb=8ef618ef05070642849f50861399116c2d69a816;hp=c0b409debc9bc8e1e2d8cb2ffd0b7d928ecdda5a;hpb=c794dbb87592782913af0a09784ed25e019e4d10;p=vchess.git diff --git a/public/javascripts/components/problemSummary.js b/public/javascripts/components/problemSummary.js index c0b409de..2c9ea94e 100644 --- a/public/javascripts/components/problemSummary.js +++ b/public/javascripts/components/problemSummary.js @@ -1,28 +1,36 @@ -// Show a problem summary on variant page -Vue.component('my-problem-summary', { - props: ['prob'], +// Preview a problem on variant page +Vue.component('my-problem-preview', { + props: ['prob','userid'], template: ` -
-
-
-
{{ timestamp2date(prob.added) }}
+
+
+
+
+

+

+

{{ timestamp2date(prob.added) }}

+
+ + +
+
`, methods: { getDiagram: function(fen) { - const fenParts = fen.split(" "); + const fenParsed = V.ParseFen(fen); return getDiagram({ - position: fenParts[0], + position: fenParsed.position, + turn: fenParsed.turn, // No need for flags here - turn: fenParts[2], }); }, timestamp2date(ts) { return getDate(new Date(ts)); }, - // Propagate "show problem" event to parent component (my-problems) - showProblem: function() { - this.$emit('show-problem'); + sendSignal: function(action) { + this.$emit(action + "-problem"); }, }, })