[alphabetical-sort] Done with checkbox
This commit is contained in:
parent
306d562f65
commit
556f7ab6bf
|
@ -18,6 +18,23 @@
|
||||||
{{ $t('filters.attributes.showDoneTasks') }}
|
{{ $t('filters.attributes.showDoneTasks') }}
|
||||||
</fancycheckbox>
|
</fancycheckbox>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">{{ $t('task.attributes.sortAlphabetically') }}</label>
|
||||||
|
<div class="control">
|
||||||
|
<flat-pickr
|
||||||
|
:config="flatPickerConfig"
|
||||||
|
@on-close="setStartDateFilter"
|
||||||
|
class="input"
|
||||||
|
:placeholder="$t('filters.attributes.sortAlphabetically')"
|
||||||
|
v-model="filters.startDate"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control">
|
||||||
|
<fancycheckbox @change="setSortAlphabetically" v-model="sortAlphabetically">
|
||||||
|
{{ $t('filters.attributes.sortAlphabetically') }}
|
||||||
|
</fancycheckbox>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">{{ $t('misc.search') }}</label>
|
<label class="label">{{ $t('misc.search') }}</label>
|
||||||
|
@ -190,6 +207,7 @@ import NamespaceService from '@/services/namespace'
|
||||||
import EditLabels from '@/components/tasks/partials/editLabels.vue'
|
import EditLabels from '@/components/tasks/partials/editLabels.vue'
|
||||||
|
|
||||||
import {objectToSnakeCase} from '@/helpers/case'
|
import {objectToSnakeCase} from '@/helpers/case'
|
||||||
|
import {getDefaultParams} from "../../tasks/mixins/taskList"
|
||||||
|
|
||||||
// FIXME: merge with DEFAULT_PARAMS in taskList.js
|
// FIXME: merge with DEFAULT_PARAMS in taskList.js
|
||||||
const DEFAULT_PARAMS = {
|
const DEFAULT_PARAMS = {
|
||||||
|
@ -234,6 +252,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
params: DEFAULT_PARAMS,
|
params: DEFAULT_PARAMS,
|
||||||
filters: DEFAULT_FILTERS,
|
filters: DEFAULT_FILTERS,
|
||||||
|
sortAlphabetically: false,
|
||||||
|
|
||||||
usersService: new UserService(),
|
usersService: new UserService(),
|
||||||
foundusers: [],
|
foundusers: [],
|
||||||
|
@ -490,6 +509,16 @@ export default {
|
||||||
}
|
}
|
||||||
this.change()
|
this.change()
|
||||||
},
|
},
|
||||||
|
setSortAlphabetically() {
|
||||||
|
if ( ! this.sortAlphabetically) {
|
||||||
|
this.params.sort_by = getDefaultParams().sort_by
|
||||||
|
this.sortAlphabetically = false
|
||||||
|
} else {
|
||||||
|
this.params.sort_by = ['title']
|
||||||
|
this.sortAlphabetically = true
|
||||||
|
}
|
||||||
|
this.change()
|
||||||
|
},
|
||||||
setFilterConcat() {
|
setFilterConcat() {
|
||||||
if (this.filters.requireAllFilters) {
|
if (this.filters.requireAllFilters) {
|
||||||
this.params.filter_concat = 'and'
|
this.params.filter_concat = 'and'
|
||||||
|
|
|
@ -27,6 +27,8 @@ export default {
|
||||||
|
|
||||||
showTaskFilter: false,
|
showTaskFilter: false,
|
||||||
params: {...getDefaultParams()},
|
params: {...getDefaultParams()},
|
||||||
|
|
||||||
|
sorting: getDefaultParams().sort_by,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -44,7 +46,10 @@ export default {
|
||||||
params = null,
|
params = null,
|
||||||
forceLoading = false,
|
forceLoading = false,
|
||||||
) {
|
) {
|
||||||
|
console.log( page )
|
||||||
|
console.log( search )
|
||||||
|
console.log( params )
|
||||||
|
console.log( forceLoading )
|
||||||
// Because this function is triggered every time on topNavigation, we're putting a condition here to only load it when we actually want to show tasks
|
// Because this function is triggered every time on topNavigation, we're putting a condition here to only load it when we actually want to show tasks
|
||||||
// FIXME: This is a bit hacky -> Cleanup.
|
// FIXME: This is a bit hacky -> Cleanup.
|
||||||
if (
|
if (
|
||||||
|
@ -59,10 +64,15 @@ export default {
|
||||||
params = this.params
|
params = this.params
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log( this.params )
|
||||||
|
|
||||||
if (search !== '') {
|
if (search !== '') {
|
||||||
params.s = search
|
params.s = search
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Save current sort
|
||||||
|
this.sorting = params.sort_by
|
||||||
|
|
||||||
const list = {listId: parseInt(this.$route.params.listId)}
|
const list = {listId: parseInt(this.$route.params.listId)}
|
||||||
|
|
||||||
const currentList = {
|
const currentList = {
|
||||||
|
|
|
@ -373,6 +373,7 @@
|
||||||
"includeNulls": "Include Tasks which don't have a value set",
|
"includeNulls": "Include Tasks which don't have a value set",
|
||||||
"requireAll": "Require all filters to be true for a task to show up",
|
"requireAll": "Require all filters to be true for a task to show up",
|
||||||
"showDoneTasks": "Show Done Tasks",
|
"showDoneTasks": "Show Done Tasks",
|
||||||
|
"sortAlphabetically": "Sort Alphabetically",
|
||||||
"enablePriority": "Enable Filter By Priority",
|
"enablePriority": "Enable Filter By Priority",
|
||||||
"enablePercentDone": "Enable Filter By Percent Done",
|
"enablePercentDone": "Enable Filter By Percent Done",
|
||||||
"dueDateRange": "Due Date Range",
|
"dueDateRange": "Due Date Range",
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
:disabled="!canWrite"
|
:disabled="!canWrite"
|
||||||
item-key="id"
|
item-key="id"
|
||||||
:component-data="{
|
:component-data="{
|
||||||
class: { 'dragging-disabled': !canWrite },
|
class: { 'dragging-disabled': !canWrite || !canDrag },
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<template #item="{element: t}">
|
<template #item="{element: t}">
|
||||||
|
@ -216,6 +216,9 @@ export default {
|
||||||
canWrite() {
|
canWrite() {
|
||||||
return this.list.maxRight > Rights.READ && this.list.id > 0
|
return this.list.maxRight > Rights.READ && this.list.id > 0
|
||||||
},
|
},
|
||||||
|
canDrag() {
|
||||||
|
return ! this.isAlphabeticalSorting()
|
||||||
|
},
|
||||||
list() {
|
list() {
|
||||||
return this.$store.state.currentList
|
return this.$store.state.currentList
|
||||||
},
|
},
|
||||||
|
@ -224,6 +227,9 @@ export default {
|
||||||
this.$nextTick(() => (this.ctaVisible = true))
|
this.$nextTick(() => (this.ctaVisible = true))
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
isAlphabeticalSorting() {
|
||||||
|
return this.sorting.find( sortBy => sortBy === 'title' ) !== undefined
|
||||||
|
},
|
||||||
searchTasks() {
|
searchTasks() {
|
||||||
// Only search if the search term changed
|
// Only search if the search term changed
|
||||||
if (this.$route.query === this.searchTerm) {
|
if (this.$route.query === this.searchTerm) {
|
||||||
|
@ -254,13 +260,17 @@ export default {
|
||||||
focusNewTaskInput() {
|
focusNewTaskInput() {
|
||||||
this.$refs.newTaskInput.$refs.newTaskInput.focus()
|
this.$refs.newTaskInput.$refs.newTaskInput.focus()
|
||||||
},
|
},
|
||||||
updateTaskList(task) {
|
updateTaskList() {
|
||||||
const tasks = [
|
// const tasks = [
|
||||||
task,
|
// task,
|
||||||
...this.tasks,
|
// ...this.tasks,
|
||||||
]
|
// ]
|
||||||
this.tasks = tasks
|
// this.tasks = tasks
|
||||||
this.$store.commit(HAS_TASKS, true)
|
this.$store.commit(HAS_TASKS, true)
|
||||||
|
this.reloadTasksWithCurrentFilterAndSorting()
|
||||||
|
},
|
||||||
|
reloadTasksWithCurrentFilterAndSorting(){
|
||||||
|
this.loadTasks(undefined, undefined, undefined, true)
|
||||||
},
|
},
|
||||||
editTask(id) {
|
editTask(id) {
|
||||||
// Find the selected task and set it to the current object
|
// Find the selected task and set it to the current object
|
||||||
|
|
|
@ -125,6 +125,9 @@ export default defineConfig({
|
||||||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
|
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
|
watch: {
|
||||||
|
usePolling: true,
|
||||||
|
},
|
||||||
port: 5000,
|
port: 5000,
|
||||||
strictPort: true,
|
strictPort: true,
|
||||||
},
|
},
|
||||||
|
|
Reference in New Issue
Block a user