mirror of https://github.com/Lissy93/dashy.git
🐛 (#252) Ignore local storage collapse state, if set by user
This commit is contained in:
parent
009a8354a5
commit
2d778bee98
|
@ -45,7 +45,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
/* Check that row & column span is valid, and not over the max */
|
/* Check that row & column span is valid, and not over the max */
|
||||||
checkSpanNum(span, classPrefix) {
|
checkSpanNum(span, classPrefix) {
|
||||||
const maxSpan = 4;
|
const maxSpan = 8;
|
||||||
let numSpan = /^\d*$/.test(span) ? parseInt(span, 10) : 1;
|
let numSpan = /^\d*$/.test(span) ? parseInt(span, 10) : 1;
|
||||||
numSpan = (numSpan > maxSpan) ? maxSpan : numSpan;
|
numSpan = (numSpan > maxSpan) ? maxSpan : numSpan;
|
||||||
return `${classPrefix}-${numSpan}`;
|
return `${classPrefix}-${numSpan}`;
|
||||||
|
@ -68,7 +68,9 @@ export default {
|
||||||
}
|
}
|
||||||
return JSON.parse(localStorage[localStorageKeys.COLLAPSE_STATE]);
|
return JSON.parse(localStorage[localStorageKeys.COLLAPSE_STATE]);
|
||||||
},
|
},
|
||||||
|
/* If not specified by user, get last state from local storage */
|
||||||
getCollapseState() {
|
getCollapseState() {
|
||||||
|
if (this.collapsed !== undefined) return !this.collapsed;
|
||||||
const collapseStateObject = this.initialiseStorage();
|
const collapseStateObject = this.initialiseStorage();
|
||||||
let collapseState = !this.collapsed;
|
let collapseState = !this.collapsed;
|
||||||
if (collapseStateObject[this.uniqueKey] !== undefined) {
|
if (collapseStateObject[this.uniqueKey] !== undefined) {
|
||||||
|
|
Loading…
Reference in New Issue