Show namespace name in list search field
continuous-integration/drone/push Build is passing Details

Resolves #169
This commit is contained in:
kolaente 2020-06-27 23:12:33 +02:00
parent cd588caa02
commit d49cf5635b
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
4 changed files with 25 additions and 2 deletions

View File

@ -18,6 +18,10 @@
<template slot="clear" slot-scope="props">
<div class="multiselect__clear" v-if="list !== null && list.id !== 0" @mousedown.prevent.stop="clearAll(props.search)"></div>
</template>
<template slot="option" slot-scope="props">
<span class="list-namespace-title">{{ namespace(props.option.namespaceId) }} ></span>
{{ props.option.title }}
</template>
<span slot="noResult">No list found. Consider changing the search query.</span>
</multiselect>
</template>
@ -64,6 +68,13 @@
select(list) {
this.$emit('selected', list)
},
namespace(namespaceId) {
const namespace = this.$store.getters['namespaces/getNamespaceById'](namespaceId)
if (namespace !== null) {
return namespace.title
}
return 'Shared Lists'
},
},
}
</script>

View File

@ -60,6 +60,14 @@ export default {
}
return null
},
getNamespaceById: state => namespaceId => {
for (const n in state.namespaces) {
if (state.namespaces[n].id === namespaceId) {
return state.namespaces[n]
}
}
return null
},
},
actions: {
loadNamespaces(ctx) {
@ -77,7 +85,7 @@ export default {
})
})
ctx.commit('lists/addLists', lists, {root:true})
ctx.commit('lists/addLists', lists, {root: true})
return Promise.resolve()
})

View File

@ -142,3 +142,7 @@
}
}
}
.list-namespace-title {
color: $grey;
}

View File

@ -229,7 +229,7 @@
</h3>
<div class="field has-addons">
<div class="control is-expanded">
<list-search @selected="changeList"/>
<list-search @selected="changeList" ref="moveList"/>
</div>
</div>
</div>