From 70c532daad8892fa488c6a53173f26edc44870a2 Mon Sep 17 00:00:00 2001 From: Seth Ladygo Date: Fri, 17 May 2019 22:55:47 -0700 Subject: [PATCH] revive SectionDeleteDialog --- cateditor/src/components/CatalogContents.vue | 11 ++++- .../src/components/SectionDeleteDialog.vue | 43 ++++++++++++++----- cateditor/src/pages/editor/store/index.js | 10 +++++ 3 files changed, 52 insertions(+), 12 deletions(-) diff --git a/cateditor/src/components/CatalogContents.vue b/cateditor/src/components/CatalogContents.vue index eb9a4ef..b00c386 100644 --- a/cateditor/src/components/CatalogContents.vue +++ b/cateditor/src/components/CatalogContents.vue @@ -41,7 +41,7 @@ info - + delete @@ -132,6 +132,7 @@ + @@ -146,6 +147,7 @@ import DragListHeading from './DragListHeading' import AddProductDialog from './AddProductDialog' import AddSectionDialog from './AddSectionDialog' import SectionInfoDialog from './SectionInfoDialog' +import SectionDeleteDialog from './SectionDeleteDialog' export default { components: { @@ -153,6 +155,7 @@ export default { AddProductDialog, AddSectionDialog, SectionInfoDialog, + SectionDeleteDialog, //RawDisplayer, }, @@ -160,6 +163,7 @@ export default { showAddProductDialog: false, showAddSectionDialog: false, showSectionInfoDialog: false, + showSectionDeleteDialog: false, }), computed: { ...mapState([ @@ -249,6 +253,11 @@ export default { this.showSectionInfoDialog = true }, + popSectionDelete(id) { + this.selectSection(id) + this.showSectionDeleteDialog = true + }, + ...mapActions([ 'selectSection', 'reorderSection', diff --git a/cateditor/src/components/SectionDeleteDialog.vue b/cateditor/src/components/SectionDeleteDialog.vue index 17dd3b0..04a02ac 100644 --- a/cateditor/src/components/SectionDeleteDialog.vue +++ b/cateditor/src/components/SectionDeleteDialog.vue @@ -2,17 +2,22 @@ - Delete Section + + + clear + + - Really delete section: - + Really delete section? + Cancel - OK + OK + @@ -20,8 +25,13 @@ diff --git a/cateditor/src/pages/editor/store/index.js b/cateditor/src/pages/editor/store/index.js index ea5af4d..16a33a4 100644 --- a/cateditor/src/pages/editor/store/index.js +++ b/cateditor/src/pages/editor/store/index.js @@ -189,6 +189,12 @@ export const store = new Vuex.Store({ state.catalog.sections.push(section) }, + deleteSection(state, section) { + if (section) { + state.catalog.sections = state.catalog.sections.filter(s => s.id !== section.id) + } + }, + setSectionName(state, { section, name }) { section.name = name }, @@ -296,6 +302,10 @@ export const store = new Vuex.Store({ commit('addSection', section) }, + deleteSection({ commit, getters }, section) { + commit('deleteSection', section) + }, + setSectionName({ commit }, payload) { commit('setSectionName', payload) },