Implements move, copy and delete item, and delete section functionality

This commit is contained in:
Alicia Sykes
2021-10-25 19:11:13 +01:00
parent f398a374e7
commit 31e172befb
10 changed files with 75 additions and 15 deletions

View File

@@ -115,6 +115,7 @@ export default {
background: var(--interactive-editor-background-darker);
border-radius: var(--curve-factor);
box-shadow: 0px 0px 3px var(--interactive-editor-color);
margin-bottom: 1.5rem;
span {
font-family: var(--font-monospace);
}

View File

@@ -14,7 +14,7 @@
<Select
v-model="selectedSection"
:options="sectionList"
:initialOption="currentSection"
:initialOption="selectedSection"
label="Destination"
/>
<Radio
@@ -84,15 +84,19 @@ export default {
return sectionName;
},
},
mounted() {
this.selectedSection = this.currentSection;
},
methods: {
save() {
const item = this.$store.getters.getItemById(this.itemId);
// Copy item to new section
const copyPayload = { item, toSection: this.selectedSection };
const copyPayload = { item, toSection: this.selectedSection, appendTo: this.appendTo };
this.$store.commit(StoreKeys.COPY_ITEM, copyPayload);
// Remove item from previous section
if (this.operation === 'Move') {
// TODO: Remove
const payload = { itemId: this.itemId, sectionName: this.currentSection };
this.$store.commit(StoreKeys.REMOVE_ITEM, payload);
}
this.close();
},