Show namespace name in list search field
All checks were successful
continuous-integration/drone/push Build is passing

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"> <template slot="clear" slot-scope="props">
<div class="multiselect__clear" v-if="list !== null && list.id !== 0" @mousedown.prevent.stop="clearAll(props.search)"></div> <div class="multiselect__clear" v-if="list !== null && list.id !== 0" @mousedown.prevent.stop="clearAll(props.search)"></div>
</template> </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> <span slot="noResult">No list found. Consider changing the search query.</span>
</multiselect> </multiselect>
</template> </template>
@ -64,6 +68,13 @@
select(list) { select(list) {
this.$emit('selected', 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> </script>

View File

@ -60,6 +60,14 @@ export default {
} }
return null return null
}, },
getNamespaceById: state => namespaceId => {
for (const n in state.namespaces) {
if (state.namespaces[n].id === namespaceId) {
return state.namespaces[n]
}
}
return null
},
}, },
actions: { actions: {
loadNamespaces(ctx) { 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() return Promise.resolve()
}) })

View File

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

View File

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