Cleanup code & make sure it has a common code style
This commit is contained in:
parent
4a8b15e7be
commit
a8a7f70a3c
132 changed files with 6821 additions and 6595 deletions
|
|
@ -7,11 +7,11 @@
|
|||
Create new namespace
|
||||
</router-link>
|
||||
|
||||
<fancycheckbox v-model="showArchived" class="show-archived-check">
|
||||
<fancycheckbox class="show-archived-check" v-model="showArchived">
|
||||
Show Archived
|
||||
</fancycheckbox>
|
||||
|
||||
<div class="namespace" v-for="n in namespaces" :key="`n${n.id}`">
|
||||
<div :key="`n${n.id}`" class="namespace" v-for="n in namespaces">
|
||||
<h1>
|
||||
<span>{{ n.title }}</span>
|
||||
<span class="is-archived" v-if="n.isArchived">
|
||||
|
|
@ -22,18 +22,18 @@
|
|||
<div class="lists">
|
||||
<template v-for="l in n.lists">
|
||||
<router-link
|
||||
:to="{ name: 'list.index', params: { listId: l.id} }"
|
||||
class="list"
|
||||
:key="`l${l.id}`"
|
||||
v-if="showArchived ? true : !l.isArchived"
|
||||
:style="{
|
||||
'background-color': l.hexColor,
|
||||
'background-image': typeof backgrounds[l.id] !== 'undefined' ? `url(${backgrounds[l.id]})` : false,
|
||||
}"
|
||||
:class="{
|
||||
:class="{
|
||||
'has-light-text': !colorIsDark(l.hexColor),
|
||||
'has-background': typeof backgrounds[l.id] !== 'undefined',
|
||||
}"
|
||||
:key="`l${l.id}`"
|
||||
:style="{
|
||||
'background-color': l.hexColor,
|
||||
'background-image': typeof backgrounds[l.id] !== 'undefined' ? `url(${backgrounds[l.id]})` : false,
|
||||
}"
|
||||
:to="{ name: 'list.index', params: { listId: l.id} }"
|
||||
class="list"
|
||||
v-if="showArchived ? true : !l.isArchived"
|
||||
>
|
||||
<div class="is-archived-container">
|
||||
<span class="is-archived" v-if="l.isArchived">
|
||||
|
|
@ -49,50 +49,50 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState} from 'vuex'
|
||||
import ListService from '../../services/list'
|
||||
import Fancycheckbox from '../../components/input/fancycheckbox'
|
||||
import {mapState} from 'vuex'
|
||||
import ListService from '../../services/list'
|
||||
import Fancycheckbox from '../../components/input/fancycheckbox'
|
||||
|
||||
export default {
|
||||
name: 'ListNamespaces',
|
||||
components: {
|
||||
Fancycheckbox,
|
||||
export default {
|
||||
name: 'ListNamespaces',
|
||||
components: {
|
||||
Fancycheckbox,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showArchived: false,
|
||||
// listId is the key, the object is the background blob
|
||||
backgrounds: {},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadBackgroundsForLists()
|
||||
},
|
||||
mounted() {
|
||||
this.setTitle('Namespaces & Lists')
|
||||
},
|
||||
computed: mapState({
|
||||
namespaces(state) {
|
||||
return state.namespaces.namespaces.filter(n => this.showArchived ? true : !n.isArchived)
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showArchived: false,
|
||||
// listId is the key, the object is the background blob
|
||||
backgrounds: {},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadBackgroundsForLists()
|
||||
},
|
||||
mounted() {
|
||||
this.setTitle('Namespaces & Lists')
|
||||
},
|
||||
computed: mapState({
|
||||
namespaces(state) {
|
||||
return state.namespaces.namespaces.filter(n => this.showArchived ? true : !n.isArchived)
|
||||
},
|
||||
}),
|
||||
methods: {
|
||||
loadBackgroundsForLists() {
|
||||
const listService = new ListService()
|
||||
this.namespaces.forEach(n => {
|
||||
n.lists.forEach(l => {
|
||||
if (l.backgroundInformation) {
|
||||
listService.background(l)
|
||||
.then(b => {
|
||||
this.$set(this.backgrounds, l.id, b)
|
||||
})
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
})
|
||||
}
|
||||
})
|
||||
}),
|
||||
methods: {
|
||||
loadBackgroundsForLists() {
|
||||
const listService = new ListService()
|
||||
this.namespaces.forEach(n => {
|
||||
n.lists.forEach(l => {
|
||||
if (l.backgroundInformation) {
|
||||
listService.background(l)
|
||||
.then(b => {
|
||||
this.$set(this.backgrounds, l.id, b)
|
||||
})
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
})
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Reference in a new issue