From 03dce35da8cf496ad54cae835d674f162301fc27 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Wed, 8 Mar 2023 16:34:17 -0800 Subject: [PATCH] tl: allow choosing sort order (fix #371) --- CHANGELOG.md | 3 ++- lib/Controller/PageController.php | 2 ++ src/components/Settings.vue | 29 +++++++++++++++++++++++++++++ src/components/Timeline.vue | 6 +++++- src/mixins/UserConfig.ts | 4 ++++ src/vue-globals.d.ts | 2 ++ 6 files changed, 44 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c82a564..5f170e28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,8 @@ You may need to clear browser cache to use location search. - **Feature**: Allow bulk editing of EXIF attributes other than date/time - **Feature**: Allow (optionally bulk) editing of collaborative tags - **Feature**: Show list of tags in sidebar -- **Feature**: Configurable album sorting order ([#377](https://github.com/pulsejet/memories/issues/377)) +- **Feature**: Configurable folder/album sorting order ([#371](https://github.com/pulsejet/memories/issues/371)) +- **Feature**: Configurable album list sorting order ([#377](https://github.com/pulsejet/memories/issues/377)) - **Feature**: Allow archiving photos throw folder view ([#350](https://github.com/pulsejet/memories/issues/350)) - **Feature**: Add search bar to face cluster merge dialog ([#177](https://github.com/pulsejet/memories/issues/177)) - Other fixes and features ([milestone](https://github.com/pulsejet/memories/milestone/9?closed=1)) diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index e3277c5f..ae8cad0b 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -76,6 +76,8 @@ class PageController extends Controller $pi('timelinePath', 'EMPTY'); $pi('foldersPath', '/'); $pi('showHidden', false); + $pi('sortFolderMonth', false); + $pi('sortAlbumMonth', 'true'); $pi('enableTopMemories', 'true'); // Apps enabled diff --git a/src/components/Settings.vue b/src/components/Settings.vue index b5caab16..aef09899 100644 --- a/src/components/Settings.vue +++ b/src/components/Settings.vue @@ -76,6 +76,27 @@ > {{ t("memories", "Show hidden folders") }} + + + {{ t("memories", "Treat folders as albums (sort order)") }} + + + + + + {{ t("memories", "Enable timeline view (sort order)") }} + @@ -190,6 +211,14 @@ export default defineComponent({ async updateShowHidden() { await this.updateSetting("showHidden"); }, + + async updateSortFolderMonth() { + await this.updateSetting("sortFolderMonth"); + }, + + async updateSortAlbumMonth() { + await this.updateSetting("sortAlbumMonth"); + }, }, }); diff --git a/src/components/Timeline.vue b/src/components/Timeline.vue index 858386a8..9790369e 100644 --- a/src/components/Timeline.vue +++ b/src/components/Timeline.vue @@ -271,7 +271,11 @@ export default defineComponent({ }, isMonthView(): boolean { return ( - this.$route.name === "albums" || this.$route.name === "album-share" + (this.config_sortAlbumMonth && + (this.$route.name === "albums" || + this.$route.name === "album-share")) || + (this.config_sortFolderMonth && this.$route.name === "folders") || + this.$route.query.sort === "album" ); }, /** Get view name for dynamic top matter */ diff --git a/src/mixins/UserConfig.ts b/src/mixins/UserConfig.ts index 91b59a80..47517d39 100644 --- a/src/mixins/UserConfig.ts +++ b/src/mixins/UserConfig.ts @@ -24,6 +24,10 @@ export default defineComponent({ config_showHidden: loadState("memories", "showHidden", "false") === "true", + config_sortFolderMonth: + loadState("memories", "sortFolderMonth", "false") === "true", + config_sortAlbumMonth: + loadState("memories", "sortAlbumMonth", "true") === "true", config_enableTopMemories: loadState("memories", "enableTopMemories", "false") === "true", diff --git a/src/vue-globals.d.ts b/src/vue-globals.d.ts index e16e7eef..4de803c9 100644 --- a/src/vue-globals.d.ts +++ b/src/vue-globals.d.ts @@ -17,6 +17,8 @@ declare module "vue" { config_timelinePath: string; config_foldersPath: string; config_showHidden: boolean; + config_sortFolderMonth: boolean; + config_sortAlbumMonth: boolean; config_tagsEnabled: boolean; config_recognizeEnabled: boolean; config_facerecognitionInstalled: boolean;