projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Finished problems page (untested)
[vchess.git]
/
public
/
javascripts
/
components
/
problemSummary.js
diff --git
a/public/javascripts/components/problemSummary.js
b/public/javascripts/components/problemSummary.js
index
e7e1db7
..
08109ef
100644
(file)
--- a/
public/javascripts/components/problemSummary.js
+++ b/
public/javascripts/components/problemSummary.js
@@
-1,15
+1,19
@@
-//
Show a problem summary on variant page or new problem preview
-Vue.component('my-problem-
summary
', {
- props: ['prob','
preview
'],
+//
Preview a problem on variant page
+Vue.component('my-problem-
preview
', {
+ props: ['prob','
userid
'],
template: `
template: `
- <div class="
problem row" @click="showProblem()
">
- <div class="col-sm-12 col-md-6
col-lg-3
diagram"
+ <div class="
row problem
">
+ <div class="col-sm-12 col-md-6 diagram"
v-html="getDiagram(prob.fen)">
</div>
v-html="getDiagram(prob.fen)">
</div>
- <div class="col-sm-12 col-md-6
col-lg-9
">
+ <div class="col-sm-12 col-md-6">
<p v-html="prob.instructions"></p>
<p v-html="prob.instructions"></p>
- <p v-if="preview" v-html="prob.solution"></p>
+ <p v-if="
!!prob.
preview" v-html="prob.solution"></p>
<p v-else class="problem-time">{{ timestamp2date(prob.added) }}</p>
<p v-else class="problem-time">{{ timestamp2date(prob.added) }}</p>
+ <div v-show="prob.uid==userid" class="button-group">
+ <button @click="$emit('edit-problem')">Edit</button>
+ <button @click="$emit('delete-problem')">Delete</button>
+ </div>
</div>
</div>
`,
</div>
</div>
`,
@@
-25,9
+29,5
@@
Vue.component('my-problem-summary', {
timestamp2date(ts) {
return getDate(new Date(ts));
},
timestamp2date(ts) {
return getDate(new Date(ts));
},
- // Propagate "show problem" event to parent component (my-problems)
- showProblem: function() {
- this.$emit('show-problem');
- },
},
})
},
})