<button @click="fetchProblems('backward')">Previous</button>
<button @click="fetchProblems('forward')">Next</button>
<button @click="showNewproblemModal">New</button>
- <my-problem-summary
+ <my-problem-summary v-on:show-problem="bubbleUp(p)"
v-for="(p,idx) in sortedProblems" v-bind:prob="p" v-bind:key="idx">
</my-problem-summary>
<input type="checkbox" id="modal-newproblem" class="modal">
`,
computed: {
sortedProblems: function() {
- console.log("call");
// Newest problem first
return this.problems.sort((p1,p2) => { return p2.added - p1.added; });
},
},
},
methods: {
+ // Propagate "show problem" event to parent component (my-variant)
+ bubbleUp: function(problem) {
+ 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)