From cb26908f3bc36e67685ad03528778322d4ecc810 Mon Sep 17 00:00:00 2001 From: Seth Ladygo Date: Sat, 18 May 2019 00:50:34 -0700 Subject: [PATCH] add material selection --- cateditor/src/components/CatalogContents.vue | 8 +++++++- cateditor/src/pages/editor/store/index.js | 14 +++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/cateditor/src/components/CatalogContents.vue b/cateditor/src/components/CatalogContents.vue index 7e5e636..24b836e 100644 --- a/cateditor/src/components/CatalogContents.vue +++ b/cateditor/src/components/CatalogContents.vue @@ -101,6 +101,7 @@
@@ -179,12 +180,14 @@ export default { 'materials', 'selectedSectionID', 'selectedModelID', + 'selectedMaterialID', ]), ...mapGetters([ 'section', 'sections', 'selectedSection', 'selectedModel', + 'selectedMaterial', 'sectionModels', 'modelMaterials', 'material', @@ -231,7 +234,9 @@ export default { }, materialListItemClasses(id, hovering) { - if (hovering) { + if (id === this.selectedMaterialID) { + return 'list-item primary' + } else if (hovering) { return 'list-item grey lighten-4' } else { return 'list-item' @@ -274,6 +279,7 @@ export default { ...mapActions([ 'selectSection', 'selectModel', + 'selectMaterial', 'reorderSection', 'setSectionPages', 'setModelMaterials', diff --git a/cateditor/src/pages/editor/store/index.js b/cateditor/src/pages/editor/store/index.js index 900a4a8..49a88d5 100644 --- a/cateditor/src/pages/editor/store/index.js +++ b/cateditor/src/pages/editor/store/index.js @@ -12,7 +12,7 @@ export const store = new Vuex.Store({ materials: {}, selectedSectionID: null, selectedModelID: null, - selectedMaterial: null, + selectedMaterialID: null, loadingCatalog: false, savingCatalog: false, loadingProducts: false, @@ -100,6 +100,10 @@ export const store = new Vuex.Store({ return [] }, + selectedMaterial: (state, getters) => (id) => { + return getters.material(id) + }, + /// OLD STUFF // // catalog info @@ -181,6 +185,10 @@ export const store = new Vuex.Store({ state.selectedModelID = id }, + selectMaterial(state, id) { + state.selectedMaterialID = id + }, + // // manipulation // @@ -293,6 +301,10 @@ export const store = new Vuex.Store({ context.commit('selectModel', id) }, + selectMaterial(context, id) { + context.commit('selectMaterial', id) + }, + // // manipulation //