1 // Preview a problem on variant page
2 Vue
.component('my-problem-preview', {
3 props: ['prob','userid'],
5 <div class="row problem">
6 <div class="col-sm-12 col-md-6 diagram"
7 v-html="getDiagram(prob.fen)">
9 <div class="col-sm-12 col-md-6">
10 <p v-html="prob.instructions"></p>
11 <p v-if="!!prob.preview" v-html="prob.solution"></p>
12 <p v-else class="problem-time">{{ timestamp2date(prob.added) }}</p>
13 <div v-show="prob.uid==userid" class="button-group">
14 <button @click="sendSignal('edit')'">Edit</button>
15 <button @click="sendSignal('delete')">Delete</button>
21 getDiagram: function(fen
) {
22 const fenParsed
= V
.ParseFen(fen
);
24 position: fenParsed
.position
,
26 // No need for flags here
30 return getDate(new Date(ts
));
32 sendSignal: function(action
) {
33 this.$emit(action
+ "-problem");