2022-09-25 08:31:52 +00:00
|
|
|
<template>
|
2022-10-29 05:24:19 +00:00
|
|
|
<div class="top-matter">
|
|
|
|
<NcBreadcrumbs v-if="topMatter">
|
|
|
|
<NcBreadcrumb title="Home" :to="{ name: 'folders' }">
|
|
|
|
<template #icon>
|
|
|
|
<HomeIcon :size="20" />
|
|
|
|
</template>
|
|
|
|
</NcBreadcrumb>
|
|
|
|
<NcBreadcrumb
|
|
|
|
v-for="folder in topMatter.list"
|
|
|
|
:key="folder.path"
|
|
|
|
:title="folder.text"
|
|
|
|
:to="{ name: 'folders', params: { path: folder.path } }"
|
|
|
|
/>
|
|
|
|
</NcBreadcrumbs>
|
|
|
|
|
|
|
|
<div class="right-actions">
|
2022-11-25 23:01:40 +00:00
|
|
|
<NcActions :inline="2">
|
|
|
|
<NcActionRouter
|
2023-01-18 05:18:27 +00:00
|
|
|
:to="{ query: recursive ? {} : { recursive: '1' } }"
|
2022-11-25 23:01:40 +00:00
|
|
|
close-after-click
|
|
|
|
>
|
2023-01-18 05:18:27 +00:00
|
|
|
{{
|
|
|
|
recursive
|
|
|
|
? t("memories", "Folder View")
|
|
|
|
: t("memories", "Timeline View")
|
|
|
|
}}
|
2022-11-25 23:01:40 +00:00
|
|
|
<template #icon>
|
2023-01-18 05:18:27 +00:00
|
|
|
<FoldersIcon v-if="recursive" :size="20" />
|
|
|
|
<TimelineIcon v-else :size="20" />
|
2022-11-25 23:01:40 +00:00
|
|
|
</template>
|
|
|
|
</NcActionRouter>
|
2022-10-29 05:24:19 +00:00
|
|
|
<NcActionButton
|
|
|
|
:aria-label="t('memories', 'Share folder')"
|
|
|
|
@click="$refs.shareModal.open(false)"
|
|
|
|
close-after-click
|
|
|
|
>
|
|
|
|
{{ t("memories", "Share folder") }}
|
|
|
|
<template #icon> <ShareIcon :size="20" /> </template>
|
|
|
|
</NcActionButton>
|
|
|
|
</NcActions>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<FolderShareModal ref="shareModal" />
|
|
|
|
</div>
|
2022-09-25 08:31:52 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2022-12-10 10:04:07 +00:00
|
|
|
import { defineComponent } from "vue";
|
2022-10-14 21:45:23 +00:00
|
|
|
import { TopMatterFolder, TopMatterType } from "../../types";
|
2022-11-24 19:54:29 +00:00
|
|
|
|
2022-11-24 21:07:09 +00:00
|
|
|
const NcBreadcrumbs = () =>
|
|
|
|
import("@nextcloud/vue/dist/Components/NcBreadcrumbs");
|
|
|
|
const NcBreadcrumb = () =>
|
|
|
|
import("@nextcloud/vue/dist/Components/NcBreadcrumb");
|
2022-11-24 19:54:29 +00:00
|
|
|
import NcActions from "@nextcloud/vue/dist/Components/NcActions";
|
|
|
|
import NcActionButton from "@nextcloud/vue/dist/Components/NcActionButton";
|
2022-11-25 23:01:40 +00:00
|
|
|
import NcActionRouter from "@nextcloud/vue/dist/Components/NcActionRouter";
|
2022-11-24 19:54:29 +00:00
|
|
|
|
2022-10-29 05:24:19 +00:00
|
|
|
import FolderShareModal from "../modal/FolderShareModal.vue";
|
|
|
|
|
2022-10-28 19:08:34 +00:00
|
|
|
import HomeIcon from "vue-material-design-icons/Home.vue";
|
2022-10-29 05:24:19 +00:00
|
|
|
import ShareIcon from "vue-material-design-icons/ShareVariant.vue";
|
2022-11-25 23:01:40 +00:00
|
|
|
import TimelineIcon from "vue-material-design-icons/ImageMultiple.vue";
|
|
|
|
import FoldersIcon from "vue-material-design-icons/FolderMultiple.vue";
|
2022-09-25 08:31:52 +00:00
|
|
|
|
2022-12-10 10:04:07 +00:00
|
|
|
export default defineComponent({
|
|
|
|
name: "FolderTopMatter",
|
2022-10-28 19:08:34 +00:00
|
|
|
components: {
|
|
|
|
NcBreadcrumbs,
|
|
|
|
NcBreadcrumb,
|
2022-10-29 05:24:19 +00:00
|
|
|
NcActions,
|
|
|
|
NcActionButton,
|
2022-11-25 23:01:40 +00:00
|
|
|
NcActionRouter,
|
2022-10-29 05:24:19 +00:00
|
|
|
FolderShareModal,
|
2022-10-28 19:08:34 +00:00
|
|
|
HomeIcon,
|
2022-10-29 05:24:19 +00:00
|
|
|
ShareIcon,
|
2022-11-25 23:01:40 +00:00
|
|
|
TimelineIcon,
|
2023-01-18 05:18:27 +00:00
|
|
|
FoldersIcon,
|
2022-10-28 19:08:34 +00:00
|
|
|
},
|
2022-09-25 08:31:52 +00:00
|
|
|
|
2022-12-10 18:59:36 +00:00
|
|
|
data: () => ({
|
|
|
|
topMatter: null as TopMatterFolder | null,
|
2023-01-18 05:18:27 +00:00
|
|
|
recursive: false,
|
2022-12-10 18:59:36 +00:00
|
|
|
}),
|
2022-12-10 10:04:07 +00:00
|
|
|
|
|
|
|
watch: {
|
|
|
|
$route: function (from: any, to: any) {
|
|
|
|
this.createMatter();
|
|
|
|
},
|
|
|
|
},
|
2022-09-25 08:31:52 +00:00
|
|
|
|
2022-10-28 19:08:34 +00:00
|
|
|
mounted() {
|
|
|
|
this.createMatter();
|
2022-12-10 10:04:07 +00:00
|
|
|
},
|
2022-09-25 08:31:52 +00:00
|
|
|
|
2022-12-10 10:04:07 +00:00
|
|
|
methods: {
|
|
|
|
createMatter() {
|
|
|
|
if (this.$route.name === "folders") {
|
|
|
|
let path: any = this.$route.params.path || "";
|
|
|
|
if (typeof path === "string") {
|
|
|
|
path = path.split("/");
|
|
|
|
}
|
2022-10-08 06:35:09 +00:00
|
|
|
|
2022-12-10 10:04:07 +00:00
|
|
|
this.topMatter = {
|
|
|
|
type: TopMatterType.FOLDER,
|
|
|
|
list: path
|
|
|
|
.filter((x) => x)
|
|
|
|
.map((x, idx, arr) => {
|
|
|
|
return {
|
|
|
|
text: x,
|
|
|
|
path: arr.slice(0, idx + 1).join("/"),
|
|
|
|
};
|
|
|
|
}),
|
|
|
|
};
|
2023-01-18 05:18:27 +00:00
|
|
|
this.recursive = this.$route.query.recursive === "1";
|
2022-12-10 10:04:07 +00:00
|
|
|
} else {
|
|
|
|
this.topMatter = null;
|
2023-01-05 17:51:16 +00:00
|
|
|
this.recursive = false;
|
2022-12-10 10:04:07 +00:00
|
|
|
}
|
2023-01-18 05:18:27 +00:00
|
|
|
},
|
|
|
|
},
|
2022-12-10 10:04:07 +00:00
|
|
|
});
|
2022-10-29 05:24:19 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.top-matter {
|
|
|
|
display: flex;
|
|
|
|
vertical-align: middle;
|
|
|
|
|
2023-01-05 19:01:43 +00:00
|
|
|
.breadcrumb {
|
|
|
|
min-width: 0;
|
|
|
|
}
|
|
|
|
|
2022-10-29 05:24:19 +00:00
|
|
|
.right-actions {
|
|
|
|
margin-right: 40px;
|
|
|
|
z-index: 50;
|
|
|
|
@media (max-width: 768px) {
|
|
|
|
margin-right: 10px;
|
|
|
|
}
|
2023-01-18 05:18:27 +00:00
|
|
|
|
|
|
|
:deep span {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
2022-10-29 05:24:19 +00:00
|
|
|
}
|
|
|
|
}
|
2023-01-18 05:18:27 +00:00
|
|
|
</style>
|