};
},
template: `
- <div>
- <button @click="fetchProblems('backward')">Previous</button>
- <button @click="fetchProblems('forward')">Next</button>
- <button @click="showNewproblemModal">New</button>
+ <div class="col-sm-12 col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
+ <div id="problemControls" class="button-group">
+ <button aria-label="Load previous problems" class="tooltip"
+ @click="fetchProblems('backward')">
+ <i class="material-icons">skip_previous</i>
+ </button>
+ <button aria-label="Add a problem" class="tooltip"
+ @click="showNewproblemModal">
+ New
+ </button>
+ <button aria-label="Load next problems" class="tooltip"
+ @click="fetchProblems('forward')">
+ <i class="material-icons">skip_next</i>
+ </button>
+ </div>
<my-problem-summary v-on:show-problem="bubbleUp(p)"
v-for="(p,idx) in sortedProblems"
v-bind:prob="p" v-bind:preview="false" v-bind:key="idx">
<label for="modal-newproblem" class="modal-close"></label>
<my-problem-summary v-bind:prob="newProblem" v-bind:preview="true">
</my-problem-summary>
- <div class="col-sm-12 col-md-6 col-lg-3 col-lg-offset-3 topspace">
- <button @click="sendNewProblem()">Send</button>
+ <div class="button-group">
<button @click="newProblem.stage='nothing'">Cancel</button>
+ <button @click="sendNewProblem()">Send</button>
</div>
</div>
</div>
// Newest problem first
return this.problems.sort((p1,p2) => { return p2.added - p1.added; });
},
- mailErrProblem: function() {
- return "mailto:contact@vchess.club?subject=[" + variant + " problems] error";
- },
},
methods: {
// Propagate "show problem" event to parent component (my-variant)
this.$emit('show-problem', JSON.stringify(problem));
},
fetchProblems: function(direction) {
- return; //TODO: re-activate after server side is implemented (see routes/all.js)
if (this.problems.length == 0)
return; //what could we do?!
// Search for newest date (or oldest)
previewNewProblem: function() {
if (!V.IsGoodFen(this.newProblem.fen))
return alert("Bad FEN string");
+ if (this.newProblem.instructions.length == 0)
+ return alert("Empty instructions");
+ if (this.newProblem.solution.length == 0)
+ return alert("Empty solution");
this.newProblem.stage = "preview";
},
sendNewProblem: function() {