forked from vikunja/frontend
Check if we have a list specified
This commit is contained in:
parent
0e02b38c1e
commit
e405ebe88f
|
@ -11,6 +11,7 @@
|
|||
v-focus
|
||||
v-model="newTaskText"
|
||||
ref="newTaskInput"
|
||||
@keyup="errorMessage = ''"
|
||||
/>
|
||||
<span class="icon is-small is-left">
|
||||
<icon icon="tasks"/>
|
||||
|
@ -26,10 +27,10 @@
|
|||
</x-button>
|
||||
</p>
|
||||
</div>
|
||||
<p class="help is-danger" v-if="showError && newTaskText === ''">
|
||||
{{ $t('list.list.addTitleRequired') }}
|
||||
<p class="help is-danger" v-if="errorMessage !== ''">
|
||||
{{ errorMessage }}
|
||||
</p>
|
||||
<quick-add-magic v-if="!showError"/>
|
||||
<quick-add-magic v-if="errorMessage === ''"/>
|
||||
</div>
|
||||
<!-- <div class="field is-grouped" >-->
|
||||
<!-- <p-->
|
||||
|
@ -84,7 +85,7 @@ export default {
|
|||
labelService: LabelService,
|
||||
labelTaskService: LabelTaskService,
|
||||
listIdToUse: null,
|
||||
showError: false,
|
||||
errorMessage: '',
|
||||
}
|
||||
},
|
||||
mixins: [
|
||||
|
@ -117,17 +118,21 @@ export default {
|
|||
methods: {
|
||||
addTask() {
|
||||
if (this.newTaskText === '') {
|
||||
this.showError = true
|
||||
this.errorMessage = this.$t('list.create.addTitleRequired')
|
||||
return
|
||||
}
|
||||
this.showError = false
|
||||
this.errorMessage = ''
|
||||
|
||||
this.createNewTask(this.newTaskText, 0, this.listIdToUse)
|
||||
this.createNewTask(this.newTaskText, 0, this.$store.state.auth.settings.defaultListId)
|
||||
.then(task => {
|
||||
this.newTaskText = ''
|
||||
this.$emit('taskAdded', task)
|
||||
})
|
||||
.catch(e => {
|
||||
if (e === 'NO_LIST') {
|
||||
this.errorMessage = this.$t('list.create.addListRequired')
|
||||
return
|
||||
}
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
|
|
|
@ -35,6 +35,10 @@ export default {
|
|||
listId = lId !== 0 ? lId : this.$route.params.listId
|
||||
}
|
||||
|
||||
if (typeof listId === 'undefined' || listId === 0) {
|
||||
return Promise.reject('NO_LIST')
|
||||
}
|
||||
|
||||
// Separate closure because we need to wait for the results of the user search if users were entered in the
|
||||
// task create request. Because _that_ happens in a promise, we'll need something to call when it resolves.
|
||||
const createTask = () => {
|
||||
|
@ -83,7 +87,7 @@ export default {
|
|||
.then(res => {
|
||||
return addLabelToTask(res)
|
||||
})
|
||||
.catch(e => Promise.reject(e))
|
||||
.catch(e => Promise.reject(e)),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
@ -110,7 +114,7 @@ export default {
|
|||
assignees.push(user)
|
||||
}
|
||||
return Promise.resolve(users)
|
||||
})
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
|
|
|
@ -109,7 +109,8 @@
|
|||
"header": "Create a new list",
|
||||
"titlePlaceholder": "The list's title goes here…",
|
||||
"addTitleRequired": "Please specify a title.",
|
||||
"createdSuccess": "The list was successfully created."
|
||||
"createdSuccess": "The list was successfully created.",
|
||||
"addListRequired": "Please specify a list or set a default list in the settings."
|
||||
},
|
||||
"archive": {
|
||||
"title": "Archive \"{list}\"",
|
||||
|
@ -204,7 +205,6 @@
|
|||
"title": "List",
|
||||
"add": "Add",
|
||||
"addPlaceholder": "Add a new task…",
|
||||
"addTitleRequired": "Please specify a title.",
|
||||
"empty": "This list is currently empty.",
|
||||
"newTaskCta": "Create a new task.",
|
||||
"editTask": "Edit Task"
|
||||
|
|
Loading…
Reference in New Issue
Block a user