X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FVariants.vue;h=2a3f6cf02384f8b948ea1df983918f6bc90a1095;hb=09d375717c256a2cbd71a5d3b3a4e21aee17c0ec;hp=014aca682a0488c8d99a6ff657d8e1ec96d944df;hpb=910d631b73cad5ffef1b4461157b704e7e7057d8;p=vchess.git diff --git a/client/src/views/Variants.vue b/client/src/views/Variants.vue index 014aca68..2a3f6cf0 100644 --- a/client/src/views/Variants.vue +++ b/client/src/views/Variants.vue @@ -4,11 +4,12 @@ main .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2 input#prefixFilter( v-model="curPrefix" + @input="setCurPrefix($event)" :placeholder="st.tr['Prefix?']" ) .variant.col-sm-12.col-md-5.col-lg-4( v-for="(v,idx) in filteredVariants" - :class="{'col-md-offset-1': idx%2==0, 'col-lg-offset-2': idx%2==0}" + :class="getVclasses(filteredVariants, idx)" ) router-link(:to="getLink(v.name)") h4.boxtitle.text-center {{ v.name }} @@ -47,9 +48,21 @@ export default { } }, methods: { + // oninput listener, required for smartphones: + setCurPrefix: function(e) { + this.curPrefix = e.target.value; + }, getLink: function(vname) { return "/variants/" + vname; - } + }, + getVclasses: function(varray, idx) { + const idxMod2 = idx % 2; + return { + 'col-md-offset-1': idxMod2 == 0, + 'col-lg-offset-2': idxMod2 == 0, + 'last-noneighb': idxMod2 == 0 && idx == varray.length - 1 + }; + }, } }; @@ -74,4 +87,7 @@ input#prefixFilter .description @media screen and (max-width: 767px) margin-top: 0 + +.last-noneighb + margin: 0 auto