1
0

Merge branch 'main' into feature/date-math

# Conflicts:
#	src/views/tasks/ShowTasks.vue
This commit is contained in:
kolaente
2022-02-26 13:30:07 +01:00
29 changed files with 1182 additions and 660 deletions

View File

@ -41,7 +41,7 @@
<script setup lang="ts">
import {ref, computed, watch} from 'vue'
import { useI18n } from 'vue-i18n'
import {useI18n} from 'vue-i18n'
import {parseURL} from 'ufo'
import {checkAndSetApiUrl} from '@/helpers/checkAndSetApiUrl'
@ -61,18 +61,20 @@ const emit = defineEmits(['foundApi'])
const apiUrl = ref(window.API_URL)
const configureApi = ref(apiUrl.value === '')
const apiDomain = computed(() => parseURL(apiUrl.value).host || parseURL(window.location.href).host)
// Because we're only using this to parse the hostname, it should be fine to just prefix with http://
// regardless of whether the url is actually reachable under http.
const apiDomain = computed(() => parseURL(apiUrl.value, 'http://').host || parseURL(window.location.href).host)
watch(() => props.configureOpen, (value) => {
configureApi.value = value
}, { immediate: true })
}, {immediate: true})
const {t} = useI18n()
const errorMsg = ref('')
const successMsg = ref('')
async function setApiUrl() {
if (apiUrl.value === '') {
// Don't try to check and set an empty url

View File

@ -84,14 +84,6 @@ export default {
BaseButton,
},
mounted() {
document.addEventListener('keydown', (e) => {
// Close the model when escape is pressed
if (e.keyCode === 27) {
this.$emit('close')
}
})
},
props: {
enabled: {
type: Boolean,

View File

@ -81,7 +81,7 @@ export default {
return this.notifications.filter(n => n.readAt === null).length
},
notifications() {
return this.allNotifications.filter(n => n.name !== '')
return this.allNotifications ? this.allNotifications.filter(n => n.name !== '') : []
},
...mapState({
userInfo: state => state.auth.info,

View File

@ -10,7 +10,7 @@
v-focus
v-model="newTaskTitle"
ref="newTaskInput"
@keyup="errorMessage = ''"
@keyup="resetEmptyTitleError"
@keydown.enter="handleEnter"
/>
<span class="icon is-small is-left">
@ -135,6 +135,12 @@ const store = useStore()
const taskService = shallowReactive(new TaskService())
const errorMessage = ref('')
function resetEmptyTitleError() {
if(newTaskTitle.value !== '') {
errorMessage.value = ''
}
}
async function addTask() {
if (newTaskTitle.value === '') {
errorMessage.value = t('list.create.addTitleRequired')

View File

@ -114,7 +114,7 @@ export default {
},
async removeLabel(label) {
if (!this.taskId === 0) {
if (this.taskId !== 0) {
await this.$store.dispatch('tasks/removeLabel', {label: label, taskId: this.taskId})
}

View File

@ -190,10 +190,7 @@ export default {
this.$t('task.undoneSuccess'),
}, [{
title: 'Undo',
callback() {
this.task.done = !this.task.done
this.markAsDone(!checked)
},
callback: () => this.undoDone(checked),
}])
}
@ -203,6 +200,11 @@ export default {
await updateFunc() // Don't delay it when un-marking it as it doesn't have an animation the other way around
}
},
undoDone(checked) {
this.task.done = !this.task.done
this.markAsDone(!checked)
},
async toggleFavorite() {
this.task.isFavorite = !this.task.isFavorite