forked from vikunja/frontend
Home List Selector
This commit is contained in:
parent
9bbc1bf939
commit
f62b4fca5c
@ -32,6 +32,11 @@ const props = defineProps({
|
||||
},
|
||||
required: false,
|
||||
},
|
||||
includeFilters:{
|
||||
type: Boolean as PropType<Boolean>,
|
||||
required: false,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
@ -54,7 +59,7 @@ function findLists(query: string) {
|
||||
if (query === '') {
|
||||
select(null)
|
||||
}
|
||||
foundLists.value = store.getters['lists/searchList'](query)
|
||||
foundLists.value = store.getters['lists/searchList'](query,false,props.includeFilters)
|
||||
}
|
||||
|
||||
function select(l: ListModel | null) {
|
||||
|
@ -10,6 +10,7 @@ export default class UserSettingsModel extends AbstractModel {
|
||||
discoverableByEmail: false,
|
||||
overdueTasksRemindersEnabled: true,
|
||||
defaultListId: undefined,
|
||||
homeListId: undefined,
|
||||
weekStart: 0,
|
||||
timezone: '',
|
||||
}
|
||||
|
@ -40,9 +40,9 @@ export default {
|
||||
})
|
||||
return typeof list === 'undefined' ? null : list
|
||||
},
|
||||
searchList: state => (query, includeArchived = false) => {
|
||||
searchList: state => (query, includeArchived = false, includeFilters = false) => {
|
||||
return search(query)
|
||||
?.filter(value => value > 0)
|
||||
?.filter(value => value > 0 || includeFilters)
|
||||
.map(id => state[id])
|
||||
.filter(list => list.isArchived === includeArchived)
|
||||
|| []
|
||||
|
@ -59,6 +59,8 @@ import DatepickerWithRange from '@/components/date/datepickerWithRange.vue'
|
||||
import {DATE_RANGES} from '@/components/date/dateRanges'
|
||||
import {LOADING, LOADING_MODULE} from '@/store/mutation-types'
|
||||
import LlamaCool from '@/assets/llama-cool.svg?component'
|
||||
import TaskCollectionService from '../../services/taskCollection'
|
||||
|
||||
|
||||
const store = useStore()
|
||||
const route = useRoute()
|
||||
@ -85,6 +87,7 @@ const {
|
||||
}>()
|
||||
|
||||
const showAll = computed(() => typeof dateFrom === 'undefined' || typeof dateTo === 'undefined')
|
||||
const homeListId = computed(() => store.state.auth.settings.homeListId)
|
||||
|
||||
const pageTitle = computed(() => {
|
||||
// We need to define "key" because it is the first parameter in the array and we need the second
|
||||
@ -152,7 +155,10 @@ async function loadPendingTasks(from: string, to: string) {
|
||||
if (!userAuthenticated.value) {
|
||||
return
|
||||
}
|
||||
|
||||
if(homeListId.value !== 0){
|
||||
tasks.value = await (new TaskCollectionService().getAll({listId: homeListId.value}))
|
||||
return;
|
||||
}
|
||||
const params = {
|
||||
sortBy: ['due_date', 'id'],
|
||||
orderBy: ['asc', 'desc'],
|
||||
|
@ -18,6 +18,12 @@
|
||||
</label>
|
||||
<list-search v-model="defaultList"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label">
|
||||
{{ $t('user.settings.general.homeList') }}
|
||||
</label>
|
||||
<list-search v-model="homeList" :includeFilters="true"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" v-model="settings.emailRemindersEnabled"/>
|
||||
@ -226,6 +232,12 @@ const defaultList = computed({
|
||||
settings.defaultListId = l ? l.id : DEFAULT_LIST_ID
|
||||
},
|
||||
})
|
||||
const homeList = computed({
|
||||
get: () => store.getters['lists/getListById'](settings.homeListId),
|
||||
set(l) {
|
||||
settings.homeListId = l ? l.id : DEFAULT_LIST_ID
|
||||
},
|
||||
})
|
||||
const loading = computed(() => store.state.loading && store.state.loadingModule === 'general-settings')
|
||||
|
||||
watch(
|
||||
|
Loading…
x
Reference in New Issue
Block a user