diff --git a/config/config.yml b/config/config.yml index b2581b5..27f2d9c 100644 --- a/config/config.yml +++ b/config/config.yml @@ -68,7 +68,7 @@ tags: - BELLEGARDE SU CARREFOUR - ST CLAUDE CASINOCARB train: - name: train + name: Train variant: danger icon: train color: '#eb2f06' @@ -91,3 +91,18 @@ tags: - INTERMARCHE - LA FERME DU COIN - ARBENT GEANT + vacances: + color: '#ff8a00' + icon: map-marked + name: Vacances + variant: '' + words: + - VACANCES + resto-bar: + color: '#6ea5fc' + icon: utensils + name: Resto-bar + variant: '' + words: + - ALVEOLES + - LYON FRITE ALORS ! diff --git a/src/components/associate_tag_keyword.vue b/src/components/associate_tag_keyword.vue new file mode 100644 index 0000000..9cb0366 --- /dev/null +++ b/src/components/associate_tag_keyword.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/src/store/modules/config.js b/src/store/modules/config.js index 31eb2f5..ba85677 100644 --- a/src/store/modules/config.js +++ b/src/store/modules/config.js @@ -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) } } } diff --git a/src/views/home.vue b/src/views/home.vue index b657780..f8b42a5 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -22,7 +22,7 @@
- +
@@ -30,11 +30,26 @@ @@ -58,6 +73,7 @@ import { mapGetters, mapActions } from 'vuex' import cardCategorie from '../components/card_categorie' import tagsComparison from '../components/graph_tags_comparison' import graphTime from '../components/graph_time' +import associateTagKeyword from '../components/associate_tag_keyword' import moment from 'moment' moment.locale('fr') @@ -67,7 +83,8 @@ export default { components: { cardCategorie: cardCategorie, tagsComparison: tagsComparison, - graphTime: graphTime + graphTime: graphTime, + associateTagKeyword: associateTagKeyword }, data () { return { @@ -94,7 +111,8 @@ export default { variant: 'info', icon: 'file-invoice-dollar' }, - categories_filter: [] + categories_filter: [], + keyword: '' } }, computed: { @@ -118,6 +136,9 @@ export default { ]), set_categories_filter (categorienames) { this.categories_filter = categorienames + }, + showModal (name) { + console.log(name) } } }