Separate client and server codes. Keep everything in one git repo for simplicity
[vchess.git] / client / client_OLD / javascripts / components / variantSummary.js
diff --git a/client/client_OLD/javascripts/components/variantSummary.js b/client/client_OLD/javascripts/components/variantSummary.js
new file mode 100644 (file)
index 0000000..16b06ce
--- /dev/null
@@ -0,0 +1,30 @@
+// Show a variant summary on index
+Vue.component('my-variant-summary', {
+       props: ['vobj','index'],
+       template: `
+               <div class="variant col-sm-12 col-md-5 col-lg-4" :id="vobj.name"
+                       :class="{'col-md-offset-1': index%2==0, 'col-lg-offset-2': index%2==0}">
+                       <a :href="url">
+                               <h4 class="boxtitle text-center">
+                                       {{ vobj.name }}
+                                       <span class="count-players">
+                                               / {{ vobj.count }}
+                                       </span>
+                               </h4>
+                               <p class="description text-center">
+                                       {{ translate(vobj.desc) }}
+                               </p>
+                       </a>
+               </div>
+       `,
+       computed: {
+               url: function() {
+                       return "/" + this.vobj.name;
+               },
+       },
+       methods: {
+               translate: function(text) {
+                       return translations[text];
+               },
+       },
+})