Added edit and remove collection.
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
<ul>
|
||||
<li>
|
||||
<div class="flex-wrap">
|
||||
<h3 class="title">Add New Collection</h3>
|
||||
<h3 class="title" v-if='!newCollection.hasOwnProperty("collectionIndex")'>Add New Collection</h3>
|
||||
<h3 class="title" v-if='newCollection.hasOwnProperty("collectionIndex")'>Edit Collection</h3>
|
||||
<div>
|
||||
<button class="icon" @click="hideModel">
|
||||
<i class="material-icons">close</i>
|
||||
@@ -18,12 +19,13 @@
|
||||
<div slot="body">
|
||||
<ul>
|
||||
<li>
|
||||
<input type="text" v-model="newCollection.name" placeholder="My New Collection" />
|
||||
<input type="text" v-model="newCollection.name" placeholder="My New Collection" />
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div slot="footer">
|
||||
<button @click="addNewCollection">Add</button>
|
||||
<button @click="addNewCollection" v-if='!newCollection.hasOwnProperty("collectionIndex")'>Add</button>
|
||||
<button @click="saveCollection" v-if='newCollection.hasOwnProperty("collectionIndex")'>Save</button>
|
||||
</div>
|
||||
</modal>
|
||||
</div>
|
||||
@@ -35,6 +37,7 @@ import modal from "../../components/modal";
|
||||
export default {
|
||||
props: {
|
||||
show: Boolean,
|
||||
editingCollection: Object,
|
||||
},
|
||||
components: {
|
||||
modal,
|
||||
@@ -48,6 +51,12 @@ export default {
|
||||
},
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
show() {
|
||||
if (!this.editingCollection.collectionIndex);
|
||||
this.newCollection = Object.assign({}, this.editingCollection);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
addNewCollection() {
|
||||
const newCollection = Object.assign({}, this.newCollection);
|
||||
@@ -58,6 +67,15 @@ export default {
|
||||
requests: [],
|
||||
};
|
||||
},
|
||||
saveCollection() {
|
||||
const savedCollection = Object.assign({}, this.newCollection);
|
||||
this.$emit('saved-collection', savedCollection);
|
||||
this.newCollection = {
|
||||
name: '',
|
||||
folders: [],
|
||||
requests: [],
|
||||
};
|
||||
},
|
||||
hideModel() {
|
||||
this.$emit('hide-model');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user