16b06ce47a41431313114c0e250fd287271a9161
[vchess.git] / public / javascripts / components / variantSummary.js
1 // Show a variant summary on index
2 Vue.component('my-variant-summary', {
3 props: ['vobj','index'],
4 template: `
5 <div class="variant col-sm-12 col-md-5 col-lg-4" :id="vobj.name"
6 :class="{'col-md-offset-1': index%2==0, 'col-lg-offset-2': index%2==0}">
7 <a :href="url">
8 <h4 class="boxtitle text-center">
9 {{ vobj.name }}
10 <span class="count-players">
11 / {{ vobj.count }}
12 </span>
13 </h4>
14 <p class="description text-center">
15 {{ translate(vobj.desc) }}
16 </p>
17 </a>
18 </div>
19 `,
20 computed: {
21 url: function() {
22 return "/" + this.vobj.name;
23 },
24 },
25 methods: {
26 translate: function(text) {
27 return translations[text];
28 },
29 },
30 })