forked from vikunja/frontend
Cleanup
This commit is contained in:
parent
e405ebe88f
commit
3d18c69429
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div v-if="listIdToUse !== null">
|
<div>
|
||||||
<div class="field is-grouped">
|
<div class="field is-grouped">
|
||||||
<p :class="{ 'is-loading': taskService.loading}" class="control has-icons-left is-expanded">
|
<p :class="{ 'is-loading': taskService.loading}" class="control has-icons-left is-expanded">
|
||||||
<input
|
<input
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
:placeholder="$t('list.list.addPlaceholder')"
|
:placeholder="$t('list.list.addPlaceholder')"
|
||||||
type="text"
|
type="text"
|
||||||
v-focus
|
v-focus
|
||||||
v-model="newTaskText"
|
v-model="newTaskTitle"
|
||||||
ref="newTaskInput"
|
ref="newTaskInput"
|
||||||
@keyup="errorMessage = ''"
|
@keyup="errorMessage = ''"
|
||||||
/>
|
/>
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
</p>
|
</p>
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<x-button
|
<x-button
|
||||||
:disabled="newTaskText.length === 0"
|
:disabled="newTaskTitle.length === 0"
|
||||||
@click="addTask()"
|
@click="addTask()"
|
||||||
icon="plus"
|
icon="plus"
|
||||||
>
|
>
|
||||||
|
@ -32,39 +32,6 @@
|
||||||
</p>
|
</p>
|
||||||
<quick-add-magic v-if="errorMessage === ''"/>
|
<quick-add-magic v-if="errorMessage === ''"/>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="field is-grouped" >-->
|
|
||||||
<!-- <p-->
|
|
||||||
<!-- :class="{ 'is-loading': taskService.loading }"-->
|
|
||||||
<!-- class="control has-icons-left is-expanded"-->
|
|
||||||
<!-- v-if="validListIdAvailable"-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- <input-->
|
|
||||||
<!-- :class="{ disabled: taskService.loading }"-->
|
|
||||||
<!-- @keyup.enter="addTask()"-->
|
|
||||||
<!-- class="input"-->
|
|
||||||
<!-- placeholder="Add a new task..."-->
|
|
||||||
<!-- type="text"-->
|
|
||||||
<!-- v-focus-->
|
|
||||||
<!-- v-model="newTaskText"-->
|
|
||||||
<!-- ref="newTaskInput"-->
|
|
||||||
<!-- />-->
|
|
||||||
<!-- <span class="icon is-small is-left">-->
|
|
||||||
<!-- <icon icon="tasks" />-->
|
|
||||||
<!-- </span>-->
|
|
||||||
<!-- </p>-->
|
|
||||||
<!-- <p class="control" v-if="validListIdAvailable">-->
|
|
||||||
<!-- <x-button-->
|
|
||||||
<!-- :disabled="newTaskText.length === 0"-->
|
|
||||||
<!-- @click="addTask()"-->
|
|
||||||
<!-- icon="plus"-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- Add-->
|
|
||||||
<!-- </x-button>-->
|
|
||||||
<!-- </p>-->
|
|
||||||
<!-- <p class="help is-warning" v-if="!validListIdAvailable">-->
|
|
||||||
<!-- No default list set. Please go to settings and specify default list.-->
|
|
||||||
<!-- </p> -->
|
|
||||||
<!-- </div>-->
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -79,24 +46,17 @@ export default {
|
||||||
name: 'add-task',
|
name: 'add-task',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
newTaskText: '',
|
newTaskTitle: '',
|
||||||
listService: ListService,
|
listService: ListService,
|
||||||
taskService: TaskService,
|
taskService: TaskService,
|
||||||
labelService: LabelService,
|
labelService: LabelService,
|
||||||
labelTaskService: LabelTaskService,
|
labelTaskService: LabelTaskService,
|
||||||
listIdToUse: null,
|
|
||||||
errorMessage: '',
|
errorMessage: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mixins: [
|
mixins: [
|
||||||
createTask,
|
createTask,
|
||||||
],
|
],
|
||||||
props: {
|
|
||||||
listId: {
|
|
||||||
type: Number,
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
components: {
|
components: {
|
||||||
QuickAddMagic,
|
QuickAddMagic,
|
||||||
},
|
},
|
||||||
|
@ -106,26 +66,17 @@ export default {
|
||||||
this.labelService = new LabelService()
|
this.labelService = new LabelService()
|
||||||
this.labelTaskService = new LabelTaskService()
|
this.labelTaskService = new LabelTaskService()
|
||||||
},
|
},
|
||||||
beforeMount() {
|
|
||||||
// If the parent provides the ID alway use that be falling back to the one
|
|
||||||
// stored in settings. If neither are avliable then hide the component.
|
|
||||||
if (this.listId !== undefined) {
|
|
||||||
this.listIdToUse = this.listId
|
|
||||||
} else if (this.$store.state.auth.settings.defaultListId !== undefined) {
|
|
||||||
this.listIdToUse = this.$store.state.auth.settings.defaultListId
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
addTask() {
|
addTask() {
|
||||||
if (this.newTaskText === '') {
|
if (this.newTaskTitle === '') {
|
||||||
this.errorMessage = this.$t('list.create.addTitleRequired')
|
this.errorMessage = this.$t('list.create.addTitleRequired')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.errorMessage = ''
|
this.errorMessage = ''
|
||||||
|
|
||||||
this.createNewTask(this.newTaskText, 0, this.$store.state.auth.settings.defaultListId)
|
this.createNewTask(this.newTaskTitle, 0, this.$store.state.auth.settings.defaultListId)
|
||||||
.then(task => {
|
.then(task => {
|
||||||
this.newTaskText = ''
|
this.newTaskTitle = ''
|
||||||
this.$emit('taskAdded', task)
|
this.$emit('taskAdded', task)
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
|
|
|
@ -26,6 +26,11 @@ export default {
|
||||||
const parsedTask = parseTaskText(newTaskTitle)
|
const parsedTask = parseTaskText(newTaskTitle)
|
||||||
const assignees = []
|
const assignees = []
|
||||||
|
|
||||||
|
// Uses the following ways to get the list id of the new task:
|
||||||
|
// 1. If specified in quick add magic, look in store if it exists and use it if it does
|
||||||
|
// 2. Else check if a list was passed as parameter
|
||||||
|
// 3. Otherwise use the id from the route parameter
|
||||||
|
// 4. If none of the above worked, reject the promise with an error.
|
||||||
let listId = null
|
let listId = null
|
||||||
if (parsedTask.list !== null) {
|
if (parsedTask.list !== null) {
|
||||||
const list = this.$store.getters['lists/findListByExactname'](parsedTask.list)
|
const list = this.$store.getters['lists/findListByExactname'](parsedTask.list)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user