diff options
Diffstat (limited to 'apps/files/src/components/BreadCrumbs.vue')
-rw-r--r-- | apps/files/src/components/BreadCrumbs.vue | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/apps/files/src/components/BreadCrumbs.vue b/apps/files/src/components/BreadCrumbs.vue index 7d7ebc7f1b3..8da486392f5 100644 --- a/apps/files/src/components/BreadCrumbs.vue +++ b/apps/files/src/components/BreadCrumbs.vue @@ -4,7 +4,8 @@ <NcBreadcrumb v-for="section in sections" :key="section.dir" :aria-label="t('files', `Go to the '{dir}' directory`, section)" - v-bind="section" /> + v-bind="section" + @click="onClick(section.to)" /> </NcBreadcrumbs> </template> @@ -32,7 +33,9 @@ export default Vue.extend({ computed: { dirs() { const cumulativePath = (acc) => (value) => (acc += `${value}/`) - return ['/', ...this.path.split('/').filter(Boolean).map(cumulativePath('/'))] + const paths = this.path.split('/').filter(Boolean).map(cumulativePath('/')) + // Strip away trailing slash + return ['/', ...paths.map(path => path.replace(/^(.+)\/$/, '$1'))] }, sections() { @@ -46,6 +49,15 @@ export default Vue.extend({ }) }, }, + + methods: { + onClick(to) { + debugger + if (to?.query?.dir === this.$route.query.dir) { + alert('You are already here!') + } + }, + }, }) </script> @@ -54,6 +66,10 @@ export default Vue.extend({ // Take as much space as possible flex: 1 1 100% !important; width: 100%; + + ::v-deep a { + cursor: pointer !important; + } } </style> |