api-client/components/collections/editCollection.vue

72 lines
1.5 KiB
Vue
Raw Normal View History

<template>
2019-10-25 08:14:34 +00:00
<modal v-if="show" @close="hideModel">
<div slot="header">
<ul>
<li>
<div class="flex-wrap">
<h3 class="title">Edit Collection</h3>
<div>
<button class="icon" @click="hideModel">
<i class="material-icons">close</i>
</button>
</div>
2019-10-25 08:14:34 +00:00
</div>
</li>
</ul>
</div>
<div slot="body">
<ul>
<li>
<input type="text" v-model="name" v-bind:placeholder="editingCollection.name" />
</li>
</ul>
</div>
2019-10-25 08:14:34 +00:00
<div slot="footer">
<ul>
<li>
<button class="icon" @click="saveCollection">
<i class="material-icons">save</i>
<span>Save</span>
</button>
</li>
</ul>
</div>
</modal>
</template>
<script>
2019-11-02 05:32:21 +00:00
import modal from "../../components/modal";
2019-11-02 05:32:21 +00:00
export default {
props: {
show: Boolean,
editingCollection: Object,
editingCollectionIndex: Number
},
components: {
modal
},
data() {
return {
name: undefined
};
},
methods: {
saveCollection() {
const collectionUpdated = {
...this.$props.editingCollection,
name: this.$data.name
2019-10-25 08:14:34 +00:00
};
2019-11-02 05:32:21 +00:00
this.$store.commit("postwoman/editCollection", {
collection: collectionUpdated,
collectionIndex: this.$props.editingCollectionIndex
});
this.$emit("hide-modal");
},
2019-11-02 05:32:21 +00:00
hideModel() {
this.$emit("hide-modal");
2019-10-25 08:14:34 +00:00
}
2019-11-02 05:32:21 +00:00
}
};
</script>