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", "weekStart": "Week starts on",
"weekStartSunday": "Sunday", "weekStartSunday": "Sunday",
"weekStartMonday": "Monday", "weekStartMonday": "Monday",
"language": "Language" "language": "Language",
"defaultList": "Default List"
}, },
"totp": { "totp": {
"title": "Two Factor Authentication", "title": "Two Factor Authentication",

View File

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