Feat(tag): modal for adding keywords to tag
This commit is contained in:
@@ -37,19 +37,22 @@ export default {
|
||||
},
|
||||
mutations: {
|
||||
SET_TAGS: (state, { tags }) => {
|
||||
// Set tags list
|
||||
state.tags = Object.keys(tags)
|
||||
.reduce((c, k) => (c[k.toLowerCase()] = tags[k], c), {})
|
||||
},
|
||||
APPEND_TAG: (state, { tag }) => {
|
||||
// Append or replace et tag
|
||||
Vue.set(state.tags, tag.name.toLowerCase(), tag)
|
||||
},
|
||||
DELETE_TAG: (state, { tagname }) => {
|
||||
// delete tag by its name
|
||||
Vue.delete(state.tags, tagname.toLowerCase())
|
||||
},
|
||||
SET_CATEGORIES: (state, { categories }) => {
|
||||
state.categories = Object.keys(categories)
|
||||
.reduce((c, k) => (c[k.toLowerCase()] = categories[k], c), {})
|
||||
}
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
load (context) {
|
||||
@@ -88,6 +91,11 @@ export default {
|
||||
// Revome a tag from the config
|
||||
context.commit('DELETE_TAG', { tagname: tagname })
|
||||
context.dispatch('save')
|
||||
},
|
||||
append_keywords (context, { tagName, keyword }) {
|
||||
var tag = context.getters.tag(tagName)
|
||||
tag.words.push(keyword)
|
||||
context.dispatch('edit_tag', tag)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user