1 // Preview a problem on variant page
2 Vue
.component('my-problem-summary', {
3 props: ['prob','userid','preview'],
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 <button v-show="!preview" @click="$emit('show-problem')">Show</button>
14 <div v-show="prob.uid==userid && !preview" class="button-group">
15 <button @click="$emit('edit-problem')">Edit</button>
16 <button @click="$emit('delete-problem')">Delete</button>
22 getDiagram: function(fen
) {
23 const fenParsed
= V
.ParseFen(fen
);
25 position: fenParsed
.position
,
27 // No need for flags here
31 return getDate(new Date(ts
));