Factor some lines (raw loading pug files)
[vchess.git] / client / src / views / Variants.vue
CommitLineData
5b020e73 1<template lang="pug">
7aa548e7
BA
2main
3 .row
9a3049f3 4 .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
737a5daf
BA
5 a#mainLink(href="/#/variants/list")
6 | {{ st.tr["View alphabetical variants list"] }}
7 div(v-html="content")
5b020e73
BA
8</template>
9
10<script>
11import { store } from "@/store";
70c9745d 12import afterRawLoad from "@/utils/afterRawLoad";
5b020e73 13export default {
cf2343ce 14 name: "my-variants",
5b020e73
BA
15 data: function() {
16 return {
6808d7a1 17 st: store.state
5b020e73 18 };
85e5b5c1
BA
19 },
20 computed: {
737a5daf 21 content: function() {
737a5daf 22 return (
70c9745d
BA
23 afterRawLoad(
24 require(
25 "raw-loader!@/translations/variants/" + this.st.lang + ".pug"
8b3b2151 26 ).default
70c9745d 27 )
6808d7a1 28 );
6808d7a1 29 }
85e5b5c1 30 },
5b020e73 31 methods: {
9e3f662f
BA
32 // oninput listener, required for smartphones:
33 setCurPrefix: function(e) {
34 this.curPrefix = e.target.value;
35 },
5b020e73
BA
36 getLink: function(vname) {
37 return "/variants/" + vname;
09d37571
BA
38 },
39 getVclasses: function(varray, idx) {
40 const idxMod2 = idx % 2;
41 return {
42 'col-md-offset-1': idxMod2 == 0,
43 'col-lg-offset-2': idxMod2 == 0,
44 'last-noneighb': idxMod2 == 0 && idx == varray.length - 1
45 };
46 },
6808d7a1 47 }
5b020e73
BA
48};
49</script>
50
41c80bb6 51<style lang="sass" scoped>
737a5daf 52a#mainLink
bd76b456 53 display: block
737a5daf
BA
54 margin: 10px auto
55 text-align: center
56 font-size: 1.3em
5b020e73 57</style>