Add setting for default list

This commit is contained in:
kolaente 2021-07-17 21:57:03 +02:00
parent 3d375ddf56
commit 894cf6c3f8
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 12 additions and 9 deletions

View File

@ -65,7 +65,8 @@
"weekStart": "Week starts on",
"weekStartSunday": "Sunday",
"weekStartMonday": "Monday",
"language": "Language"
"language": "Language",
"defaultList": "Default List"
},
"totp": {
"title": "Two Factor Authentication",

View File

@ -16,6 +16,12 @@
v-model="settings.name"/>
</div>
</div>
<div class="field">
<label class="label">
{{ $t('user.settings.general.defaultList') }}
</label>
<list-search @selected="changeList"/>
</div>
<div class="field">
<label class="checkbox">
<input type="checkbox" v-model="settings.emailRemindersEnabled"/>
@ -275,7 +281,6 @@ import TotpModel from '../../models/totp'
import TotpService from '../../services/totp'
import UserSettingsService from '../../services/userSettings'
import UserSettingsModel from '../../models/userSettings'
import ListService from '../../services/list'
import ListModel from '../../models/list'
import {playSoundWhenDoneKey} from '@/helpers/playPop'
import {availableLanguages, saveLanguage, getCurrentLanguage} from '@/i18n/setup'
@ -284,6 +289,7 @@ import {mapState} from 'vuex'
import AvatarSettings from '../../components/user/avatar-settings'
import copy from 'copy-to-clipboard'
import ListSearch from '@/components/tasks/partials/listSearch'
export default {
name: 'Settings',
@ -309,11 +315,11 @@ export default {
settings: UserSettingsModel,
userSettingsService: UserSettingsService,
listService: ListService,
defaultList: ListModel,
}
},
components: {
ListSearch,
AvatarSettings,
},
created() {
@ -331,8 +337,7 @@ export default {
this.playSoundWhenDone = localStorage.getItem(playSoundWhenDoneKey) === 'true' || localStorage.getItem(playSoundWhenDoneKey) === null
this.listService = new ListService()
this.defaultList = new ListModel()
this.defaultList = null
this.totpStatus()
this.getListById()
@ -452,10 +457,7 @@ export default {
this.settings.defaultListId = list.id
},
getListById() {
this.listService.get({id: this.settings.defaultListId})
.then(response => {
this.defaultList = response
})
this.defaultList = this.$store.getters['lists/getListById'](this.settings.defaultListId)
},
},
}