projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Mark rules as read also when visiting /variants/Somevariant page
[vchess.git]
/
client
/
src
/
views
/
Variants.vue
diff --git
a/client/src/views/Variants.vue
b/client/src/views/Variants.vue
index
014aca6
..
e5d0285
100644
(file)
--- 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"
.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"
: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 }}
)
router-link(:to="getLink(v.name)")
h4.boxtitle.text-center {{ v.name }}
@@
-25,6
+26,9
@@
export default {
st: store.state
};
},
st: store.state
};
},
+ mounted: function() {
+ document.getElementById("prefixFilter").focus();
+ },
computed: {
filteredVariants: function() {
const capitalizedPrefix = this.curPrefix.replace(/^\w/, c =>
computed: {
filteredVariants: function() {
const capitalizedPrefix = this.curPrefix.replace(/^\w/, c =>
@@
-47,9
+51,21
@@
export default {
}
},
methods: {
}
},
methods: {
+ // oninput listener, required for smartphones:
+ setCurPrefix: function(e) {
+ this.curPrefix = e.target.value;
+ },
getLink: function(vname) {
return "/variants/" + vname;
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
+ };
+ },
}
};
</script>
}
};
</script>
@@
-74,4
+90,7
@@
input#prefixFilter
.description
@media screen and (max-width: 767px)
margin-top: 0
.description
@media screen and (max-width: 767px)
margin-top: 0
+
+.last-noneighb
+ margin: 0 auto
</style>
</style>