feat: recursive folder view

pull/260/head
Kevin Yeh 2022-11-25 15:01:40 -08:00
parent 13fa1ae31e
commit 069db130a7
3 changed files with 25 additions and 3 deletions

View File

@ -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()

View File

@ -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

View File

@ -15,7 +15,17 @@
</NcBreadcrumbs>
<div class="right-actions">
<NcActions :inline="1">
<NcActions :inline="2">
<NcActionRouter
:to="{...this.$route, query: {recursive: recursive ? undefined : '1'}}"
close-after-click
>
{{ t("memories", recursive ? "Show folders" : "Timeline") }}
<template #icon>
<TimelineIcon v-if="recursive" :size="20"/>
<FoldersIcon v-else :size="20"/>
</template>
</NcActionRouter>
<NcActionButton
:aria-label="t('memories', 'Share folder')"
@click="$refs.shareModal.open(false)"
@ -41,6 +51,7 @@ const NcBreadcrumb = () =>
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;
}
}
}