vikunja-frontend/src/components/lists/NewList.vue

84 lines
2 KiB
Vue
Raw Normal View History

2018-09-09 21:28:07 +02:00
<template>
2018-12-25 16:03:51 +01:00
<div class="fullpage">
<a class="close" @click="back()">
<icon :icon="['far', 'times-circle']">
</icon>
</a>
2018-09-09 21:28:07 +02:00
<h3>Create a new list</h3>
<div class="field is-grouped">
<p class="control is-expanded" :class="{ 'is-loading': listService.loading}">
<input v-focus
class="input"
:class="{ 'disabled': listService.loading}"
v-model="list.title"
type="text"
placeholder="The list's name goes here..."
@keyup.esc="back()"
@keyup.enter="newList()"/>
</p>
<p class="control">
<button class="button is-success noshadow" @click="newList()" :disabled="list.title.length < 3">
2018-09-09 21:28:07 +02:00
<span class="icon is-small">
<icon icon="plus"/>
</span>
Add
</button>
</p>
</div>
<p class="help is-danger" v-if="showError && list.title.length < 3">
Please specify at least three characters.
</p>
2018-09-09 21:28:07 +02:00
</div>
</template>
<script>
import auth from '../../auth'
import router from '../../router'
import ListService from '../../services/list'
import ListModel from '../../models/list'
2018-09-09 21:28:07 +02:00
export default {
name: "NewList",
data() {
return {
showError: false,
list: ListModel,
listService: ListService,
}
},
beforeMount() {
// Check if the user is already logged in, if so, redirect him to the homepage
if (!auth.user.authenticated) {
router.push({name: 'home'})
}
},
2018-12-25 16:03:51 +01:00
created() {
this.list = new ListModel()
this.listService = new ListService()
2018-12-25 16:03:51 +01:00
this.$parent.setFullPage();
},
methods: {
newList() {
if (this.list.title.length < 3) {
this.showError = true
return
}
this.showError = false
this.list.namespaceId = this.$route.params.id
this.listService.create(this.list)
.then(response => {
2018-09-09 21:28:07 +02:00
this.$parent.loadNamespaces()
this.success({message: 'The list was successfully created.'}, this)
Kanban (#118) Add error message when trying to create an invalid new task in a bucket Prevent creation of new buckets if the bucket title is empty Disable deleting a bucket if it's the last one Disable dragging tasks when they are being updated Fix transition when opening tasks Send the user to list view by default Show loading spinner when updating multiple tasks Add loading spinner when moving tasks Add loading animation when bucket is loading / updating etc Add bucket title edit Fix creating new buckets Add loading animation Add removing buckets Fix creating a new bucket after tasks were moved Fix warning about labels on tasks Fix labels on tasks not updating after retrieval from api Fix property width Add closing and mobile design Make the task detail popup look good Move list views Move task detail view in a popup Add link to tasks Add saving the new task position after it was moved Fix creating new bucket Fix creating a new task Cleanup Disable user selection for task cards Fix drag placeholder Add dragging style to task Add placeholder + change animation duration More cleanup Cleanup / docs Working of dragging and dropping tasks Adjust markup and styling for new library Change kanban library to something that works Add basic calculation of new positions Don't try to create empty tasks Add indicator if a task is done Add moving tasks between buckets Make empty buckets a little smaller Add gimmick for button description Fix color Fix scrolling bucket layout Add creating a new bucket Add hiding the task input field Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/118
2020-04-26 01:11:34 +02:00
router.push({name: 'showList', params: {listId: response.id}})
})
.catch(e => {
this.error(e, this)
})
},
2018-12-25 16:03:51 +01:00
back() {
router.go(-1)
},
}
}
2018-12-25 16:03:51 +01:00
</script>