From 069db130a7c66f21e35219021278edd7c40afe2f Mon Sep 17 00:00:00 2001 From: Kevin Yeh Date: Fri, 25 Nov 2022 15:01:40 -0800 Subject: [PATCH] feat: recursive folder view --- lib/Controller/ApiBase.php | 2 +- src/components/Timeline.vue | 5 ++++- src/components/top-matter/FolderTopMatter.vue | 21 ++++++++++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lib/Controller/ApiBase.php b/lib/Controller/ApiBase.php index 7a882d30..19d92633 100644 --- a/lib/Controller/ApiBase.php +++ b/lib/Controller/ApiBase.php @@ -187,7 +187,7 @@ class ApiBase extends Controller protected function isRecursive() { - return null === $this->request->getParam('folder'); + return null === $this->request->getParam('folder') || "1" === $this->request->getParam('recursive'); } protected function isArchive() diff --git a/src/components/Timeline.vue b/src/components/Timeline.vue index b5c79554..0ad6e269 100644 --- a/src/components/Timeline.vue +++ b/src/components/Timeline.vue @@ -240,7 +240,7 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) { @Watch("$route") async routeChange(to: any, from?: any) { - if (from?.path !== to.path) { + if (from?.path !== to.path || from.query.recursive !== to.query.recursive) { await this.refresh(); } @@ -565,6 +565,9 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) { // Folder if (this.$route.name === "folders") { query.set("folder", utils.getFolderRoutePath(this.config_foldersPath)); + if(this.$route.query.recursive === "1") { + query.set("recursive", "1"); + } } // Archive diff --git a/src/components/top-matter/FolderTopMatter.vue b/src/components/top-matter/FolderTopMatter.vue index aa2ef1d0..aeab4a66 100644 --- a/src/components/top-matter/FolderTopMatter.vue +++ b/src/components/top-matter/FolderTopMatter.vue @@ -15,7 +15,17 @@
- + + + {{ t("memories", recursive ? "Show folders" : "Timeline") }} + + import("@nextcloud/vue/dist/Components/NcBreadcrumb"); import NcActions from "@nextcloud/vue/dist/Components/NcActions"; import NcActionButton from "@nextcloud/vue/dist/Components/NcActionButton"; +import NcActionRouter from "@nextcloud/vue/dist/Components/NcActionRouter"; import GlobalMixin from "../../mixins/GlobalMixin"; @@ -48,6 +59,8 @@ import FolderShareModal from "../modal/FolderShareModal.vue"; import HomeIcon from "vue-material-design-icons/Home.vue"; import ShareIcon from "vue-material-design-icons/ShareVariant.vue"; +import TimelineIcon from "vue-material-design-icons/ImageMultiple.vue"; +import FoldersIcon from "vue-material-design-icons/FolderMultiple.vue"; @Component({ components: { @@ -55,13 +68,17 @@ import ShareIcon from "vue-material-design-icons/ShareVariant.vue"; NcBreadcrumb, NcActions, NcActionButton, + NcActionRouter, FolderShareModal, HomeIcon, ShareIcon, + TimelineIcon, + FoldersIcon }, }) export default class FolderTopMatter extends Mixins(GlobalMixin) { private topMatter?: TopMatterFolder = null; + private recursive: boolean = false; @Watch("$route") async routeChange(from: any, to: any) { @@ -90,8 +107,10 @@ export default class FolderTopMatter extends Mixins(GlobalMixin) { }; }), }; + this.recursive = this.$route.query.recursive === '1' } else { this.topMatter = null; + this.recursive = false; } } }