diff --git a/src/components/list/partials/filters.vue b/src/components/list/partials/filters.vue
index 039061ac3..57fc4c5a1 100644
--- a/src/components/list/partials/filters.vue
+++ b/src/components/list/partials/filters.vue
@@ -18,6 +18,23 @@
{{ $t('filters.attributes.showDoneTasks') }}
+
+
+
+
+
+
+
+
+ {{ $t('filters.attributes.sortAlphabetically') }}
+
+
@@ -190,6 +207,7 @@ import NamespaceService from '@/services/namespace'
import EditLabels from '@/components/tasks/partials/editLabels.vue'
import {objectToSnakeCase} from '@/helpers/case'
+import {getDefaultParams} from "../../tasks/mixins/taskList"
// FIXME: merge with DEFAULT_PARAMS in taskList.js
const DEFAULT_PARAMS = {
@@ -234,6 +252,7 @@ export default {
return {
params: DEFAULT_PARAMS,
filters: DEFAULT_FILTERS,
+ sortAlphabetically: false,
usersService: new UserService(),
foundusers: [],
@@ -490,6 +509,16 @@ export default {
}
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() {
if (this.filters.requireAllFilters) {
this.params.filter_concat = 'and'
diff --git a/src/components/tasks/mixins/taskList.js b/src/components/tasks/mixins/taskList.js
index 5326b25ed..8361c6615 100644
--- a/src/components/tasks/mixins/taskList.js
+++ b/src/components/tasks/mixins/taskList.js
@@ -27,6 +27,8 @@ export default {
showTaskFilter: false,
params: {...getDefaultParams()},
+
+ sorting: getDefaultParams().sort_by,
}
},
watch: {
@@ -44,7 +46,10 @@ export default {
params = null,
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
// FIXME: This is a bit hacky -> Cleanup.
if (
@@ -59,10 +64,15 @@ export default {
params = this.params
}
+ console.log( this.params )
+
if (search !== '') {
params.s = search
}
+ //Save current sort
+ this.sorting = params.sort_by
+
const list = {listId: parseInt(this.$route.params.listId)}
const currentList = {
diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json
index 09714acd6..62cc65bf3 100644
--- a/src/i18n/lang/en.json
+++ b/src/i18n/lang/en.json
@@ -373,6 +373,7 @@
"includeNulls": "Include Tasks which don't have a value set",
"requireAll": "Require all filters to be true for a task to show up",
"showDoneTasks": "Show Done Tasks",
+ "sortAlphabetically": "Sort Alphabetically",
"enablePriority": "Enable Filter By Priority",
"enablePercentDone": "Enable Filter By Percent Done",
"dueDateRange": "Due Date Range",
diff --git a/src/views/list/views/List.vue b/src/views/list/views/List.vue
index 9d121fc65..b2e3fee6b 100644
--- a/src/views/list/views/List.vue
+++ b/src/views/list/views/List.vue
@@ -81,7 +81,7 @@
:disabled="!canWrite"
item-key="id"
:component-data="{
- class: { 'dragging-disabled': !canWrite },
+ class: { 'dragging-disabled': !canWrite || !canDrag },
}"
>
@@ -216,6 +216,9 @@ export default {
canWrite() {
return this.list.maxRight > Rights.READ && this.list.id > 0
},
+ canDrag() {
+ return ! this.isAlphabeticalSorting()
+ },
list() {
return this.$store.state.currentList
},
@@ -224,6 +227,9 @@ export default {
this.$nextTick(() => (this.ctaVisible = true))
},
methods: {
+ isAlphabeticalSorting() {
+ return this.sorting.find( sortBy => sortBy === 'title' ) !== undefined
+ },
searchTasks() {
// Only search if the search term changed
if (this.$route.query === this.searchTerm) {
@@ -254,13 +260,17 @@ export default {
focusNewTaskInput() {
this.$refs.newTaskInput.$refs.newTaskInput.focus()
},
- updateTaskList(task) {
- const tasks = [
- task,
- ...this.tasks,
- ]
- this.tasks = tasks
+ updateTaskList() {
+ // const tasks = [
+ // task,
+ // ...this.tasks,
+ // ]
+ // this.tasks = tasks
this.$store.commit(HAS_TASKS, true)
+ this.reloadTasksWithCurrentFilterAndSorting()
+ },
+ reloadTasksWithCurrentFilterAndSorting(){
+ this.loadTasks(undefined, undefined, undefined, true)
},
editTask(id) {
// Find the selected task and set it to the current object
diff --git a/vite.config.js b/vite.config.js
index 1d44bbeb4..beb42c7ac 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -125,6 +125,9 @@ export default defineConfig({
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
},
server: {
+ watch: {
+ usePolling: true,
+ },
port: 5000,
strictPort: true,
},