Draft Game and Challenge models
[vchess.git] / public / javascripts / components / gameList.js
CommitLineData
214dfe16
BA
1Vue.component("my-game-list", {
2 props: ["games"],
3 computed: {
4 showResult: function() {
5 this.games.length > 0 && this.games[0].score != "*";
6 },
7 },
8 template: `
9 <table>
10 <tr>
11 <th>Players names</th>
12 <th>Cadence</th>
60d9063f 13 <th v-if="showResult">Result</th>
214dfe16
BA
14 </tr>
15 <tr v-for="g in games" @click="$emit('show-game',g)">
16 <td>
17 <span v-for="p in g.players">{{ p.name }}</span>
18 </td>
19 <td>{{ g.mainTime }} + {{ g.increment }}</td>
20 <td v-if="showResult">{{ g.score }}</td>
21 </tr>
22 </table>
23 `,
24});