Added edit and remove collection.

This commit is contained in:
Keith Holliday
2019-10-16 07:11:34 -06:00
parent 18a0c391f6
commit ed53b433b5
5 changed files with 88 additions and 6 deletions

View File

@@ -12,13 +12,15 @@
<label @click="toggleShowChildren">
{{collection.name}}
</label>
<button class="add-button" @click="editCollection">e</button>
<button class="add-button" @click="removeCollection">x</button>
<button class="add-button" @click="toggleModal">+</button>
</div>
<div v-show="showChildren">
<ul>
<li v-for="(folder, index) in collection.folders" :key="folder.name">
<folder :folder="folder" :folderIndex="index" />
<folder :folder="folder" :folderIndex="index" :collection-index="collectionIndex" />
</li>
</ul>
@@ -94,6 +96,18 @@ export default {
});
this.showModal = false;
},
editCollection() {
this.$emit('edit-collection', {
collectionIndex: this.collectionIndex,
collection: this.collection,
});
},
removeCollection() {
if (!confirm("Are you sure you want to remove this collection?")) return;
this.$store.commit('postwoman/removeCollection', {
collectionIndex: this.collectionIndex,
});
},
}
};
</script>