|
@@ -8,17 +8,17 @@
|
|
|
</header>
|
|
|
<section class='modal-card-body'>
|
|
|
<!-- validation to check if exists http://bulma.io/documentation/elements/form/ -->
|
|
|
- <label class='label'>Name (lowercase, a-z, used in the url)</label>
|
|
|
+ <label class='label'>Unique ID (lowercase, a-z, used in the url)</label>
|
|
|
<p class='control'>
|
|
|
- <input class='input' type='text' placeholder='Name...' v-model='$parent.ccs.name'>
|
|
|
+ <input class='input' type='text' placeholder='Name...' v-model='newCommunity._id'>
|
|
|
</p>
|
|
|
- <label class='label'>Display name</label>
|
|
|
+ <label class='label'>Display Name</label>
|
|
|
<p class='control'>
|
|
|
- <input class='input' type='text' placeholder='Display name...' v-model='$parent.ccs.displayName'>
|
|
|
+ <input class='input' type='text' placeholder='Display name...' v-model='newCommunity.displayName'>
|
|
|
</p>
|
|
|
<label class='label'>Description</label>
|
|
|
<p class='control'>
|
|
|
- <input class='input' type='text' placeholder='Description...' v-model='$parent.ccs.description'>
|
|
|
+ <input class='input' type='text' placeholder='Description...' v-model='newCommunity.description'>
|
|
|
</p>
|
|
|
</section>
|
|
|
<footer class='modal-card-foot'>
|
|
@@ -30,12 +30,32 @@
|
|
|
|
|
|
<script>
|
|
|
export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ newCommunity: {
|
|
|
+ _id: '',
|
|
|
+ displayName: '',
|
|
|
+ description: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
toggleModal: function () {
|
|
|
- this.$dispatch('toggleModal', 'ccs');
|
|
|
+ this.$dispatch('toggleModal', 'createCommunityStation');
|
|
|
},
|
|
|
submitModal: function () {
|
|
|
- this.$dispatch('ccs');
|
|
|
+ let _this = this;
|
|
|
+ if (_this.community._id == '') return Toast.methods.addToast('ID cannot be a blank field', 3000);
|
|
|
+ if (_this.community.displayName == '') return Toast.methods.addToast('Display Name cannot be a blank field', 3000);
|
|
|
+ if (_this.community.description == '') return Toast.methods.addToast('Description cannot be a blank field', 3000);
|
|
|
+ this.socket.emit('stations.createCommunity', {
|
|
|
+ _id: _this.community._id,
|
|
|
+ displayName: _this.community.displayName,
|
|
|
+ description: _this.community.description
|
|
|
+ }, res => {
|
|
|
+ if (res.status === 'success') Toast.methods.addToast(`You have added the station successfully`, 4000);
|
|
|
+ else Toast.methods.addToast(res.message, 4000);
|
|
|
+ });
|
|
|
this.toggleModal();
|
|
|
}
|
|
|
}
|