Compare commits

..

No commits in common. "41d983ccbba71a3fea8ca1b18a46b8e00f32df23" and "e605292bf0758d6d66afabdf8c008aba52c66e6d" have entirely different histories.

3 changed files with 14 additions and 31 deletions

View file

@ -47,6 +47,7 @@
</template>
<script>
import router from '../router';
export default {
name: 'CollapsableCards',
@ -75,15 +76,7 @@ export default {
};
},
created() {
const query = this.$router.currentRoute.query.collapsed;
if (query !== null && query !== undefined) {
this.collapsed = this.unpackInt(parseInt(query), this.sections.length);
} else {
this.collapsed = this.sections.map(() => true);
}
//this.$router.push({...this.$router.currentRoute, query: {...this.$router.currentRoute.query, layout}});
//this.collapsed = this.sections.map(() => true);
/*this.columns.map(e => ({
k: e,
v: this.$store.getters.getFilters[e]
@ -92,31 +85,21 @@ export default {
computed: {
grouped_items() {
return this.sections.map(section => this.items.filter(item => item[this.keyName] === section.slug));
},
}
},
methods: {
packInt(arr) {
return arr.reduce((a, e, i) => a + (e ? 0 : 2 ** i), 0);
},
unpackInt(n, l) {
return [...Array(l)].map((e, i) => (n & 2 ** i) === 0);
},
toggle(index) {
const collapsed = [...this.collapsed]
collapsed[index] = !collapsed[index];
this.collapsed = collapsed;
},
},
watch: {
collapsed: {
handler() {
const encoded = this.packInt(this.collapsed).toString()
if (this.$router.currentRoute.query.collapsed !== encoded)
this.$router.push({...this.$router.currentRoute, query: {...this.$router.currentRoute.query, collapsed: encoded}});
},
deep: true,
this.collapsed[index] = !this.collapsed[index];
this.$forceUpdate();
},
/*changeFilter(col, val) {
this.setFilter(col, val);
let newquery = Object.entries({
...this.$store.getters.getFilters,
[col]: val
}).reduce((a, [k, v]) => (v ? {...a, [k]: v} : a), {});
router.push({query: newquery});
},*/
},
};
</script>

View file

@ -123,7 +123,6 @@ export default {
},
methods: {
...mapActions(['changeEvent', 'changeView', 'searchEventItems']),
...mapMutations(['logout']),
navigateTo(link) {
if (this.$router.currentRoute.path !== link)
this.$router.push(link);

View file

@ -87,6 +87,7 @@ export default {
methods: {
openLightboxModalWith(attachment) {
this.lightboxHash = attachment.hash;
console.log(this.lightboxHash);
},
closeLightboxModal() { // Closes the editing modal and discards the edited copy of the item.
this.lightboxHash = null;