Add "new label" button to label management #359

Merged
konrad merged 2 commits from profi248/frontend:new-label-button into master 2020-12-30 17:55:54 +00:00
1 changed files with 5 additions and 9 deletions
Showing only changes of commit 0506cc8726 - Show all commits

View File

@ -1,8 +1,7 @@
<template>
<div class="fullpage">
<a @click="back()" class="close">
<icon :icon="['far', 'times-circle']">
</icon>
<icon :icon="['far', 'times-circle']"/>
konrad marked this conversation as resolved Outdated

Please use <icon :icon="['far', 'times-circle']"/> instead

Please use `<icon :icon="['far', 'times-circle']"/>` instead
</a>
<h3>Create a new label</h3>
<form @keyup.esc="back()" @submit.prevent="newlabel">
@ -11,7 +10,7 @@
<input
:class="{ 'disabled': labelService.loading }"
class="input"
placeholder="The label name goes here..." type="text"
placeholder="The label title goes here..." type="text"
v-focus
konrad marked this conversation as resolved
Review

Labels actually don't have names, only titles 🙂 Could you update that here and in the error message?

Labels actually don't have names, only titles 🙂 Could you update that here and in the error message?
v-model="label.title"/>
</p>
@ -25,14 +24,13 @@
</p>
</div>
<p class="help is-danger" v-if="showError && label.title === ''">
Please specify a name.
Please specify a title.
</p>
</form>
</div>
</template>
<script>
import router from '../../router'
import labelModel from '../../models/label'
import labelService from '../../services/label'
import {IS_FULLPAGE} from '@/store/mutation-types'
@ -65,11 +63,9 @@ export default {
}
this.showError = false
console.log(this.label);
this.labelService.create(this.label)
.then(response => {
router.push({name: 'labels.index', params: {id: response.id}})
this.$router.push({name: 'labels.index', params: {id: response.id}})
konrad marked this conversation as resolved Outdated

Could you remove this?

Could you remove this?

oops, sorry about that

oops, sorry about that
this.success({message: 'The label was successfully created.'}, this)
})
.catch(e => {
@ -77,7 +73,7 @@ export default {
})
},
back() {
router.go(-1)
this.$router.go(-1)
},
},
}