2022-02-19 07:47:54 +01:00
|
|
|
<template>
|
2025-01-23 09:31:51 +01:00
|
|
|
<div v-if="$route.query.directory" class="media is-align-items-center">
|
|
|
|
<figure class="media-left is-clickable" @click="open_parent">
|
|
|
|
<mdicon class="icon" name="chevron-left" size="16" />
|
|
|
|
</figure>
|
|
|
|
<div class="media-content is-clipped">
|
2024-04-23 17:34:49 +02:00
|
|
|
<nav class="breadcrumb">
|
|
|
|
<ul>
|
|
|
|
<li v-for="directory in directories" :key="directory.index">
|
|
|
|
<a @click="open(directory)">
|
|
|
|
<span v-text="directory.name" />
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
2022-02-19 07:47:54 +01:00
|
|
|
</div>
|
|
|
|
<div class="media-right">
|
|
|
|
<slot name="actions" />
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-03-26 03:13:17 +01:00
|
|
|
<template v-for="item in items" :key="item.path">
|
2025-01-23 09:31:51 +01:00
|
|
|
<div class="media is-align-items-center" @click="open(item)">
|
|
|
|
<figure class="media-left is-clickable">
|
|
|
|
<mdicon class="icon" name="folder" size="16" />
|
|
|
|
</figure>
|
|
|
|
<div class="media-content is-clickable is-clipped">
|
|
|
|
<h1 class="title is-6" v-text="item.name" />
|
2022-02-19 07:47:54 +01:00
|
|
|
</div>
|
|
|
|
<div class="media-right">
|
2024-03-26 03:13:17 +01:00
|
|
|
<a @click.prevent.stop="open_dialog(item)">
|
2023-06-30 21:41:40 +02:00
|
|
|
<mdicon class="icon has-text-dark" name="dots-vertical" size="16" />
|
2022-02-19 07:47:54 +01:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<teleport to="#app">
|
2022-05-29 18:49:00 +02:00
|
|
|
<modal-dialog-directory
|
2024-03-26 03:13:17 +01:00
|
|
|
:item="selected_item"
|
2022-05-29 18:49:00 +02:00
|
|
|
:show="show_details_modal"
|
|
|
|
@close="show_details_modal = false"
|
|
|
|
/>
|
2022-02-19 07:47:54 +01:00
|
|
|
</teleport>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import ModalDialogDirectory from '@/components/ModalDialogDirectory.vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'ListDirectories',
|
|
|
|
components: { ModalDialogDirectory },
|
2024-03-26 03:13:17 +01:00
|
|
|
props: { items: { required: true, type: Array } },
|
2022-02-19 07:47:54 +01:00
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2024-03-26 03:13:17 +01:00
|
|
|
selected_item: '',
|
2024-03-24 11:01:06 +01:00
|
|
|
show_details_modal: false
|
2022-02-19 07:47:54 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2024-04-23 17:34:49 +02:00
|
|
|
directories() {
|
|
|
|
const directories = []
|
|
|
|
let path = ''
|
|
|
|
this.$route.query?.directory
|
|
|
|
.split('/')
|
|
|
|
.slice(1, -1)
|
|
|
|
.forEach((name, index) => {
|
|
|
|
path = `${path}/${name}`
|
|
|
|
directories.push({ index, name, path })
|
|
|
|
})
|
|
|
|
return directories
|
2022-02-19 07:47:54 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2024-03-26 03:13:17 +01:00
|
|
|
open(item) {
|
2024-04-23 17:34:49 +02:00
|
|
|
const route = { name: 'files' }
|
|
|
|
if (item.index !== 0) {
|
|
|
|
route.query = { directory: item.path }
|
|
|
|
}
|
|
|
|
this.$router.push(route)
|
2024-03-24 11:01:06 +01:00
|
|
|
},
|
2024-03-26 03:13:17 +01:00
|
|
|
open_dialog(item) {
|
|
|
|
this.selected_item = item.path
|
|
|
|
this.show_details_modal = true
|
|
|
|
},
|
|
|
|
open_parent() {
|
2024-04-23 17:34:49 +02:00
|
|
|
this.open(this.directories.slice(-1).pop())
|
2022-02-19 07:47:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2025-01-23 09:31:51 +01:00
|
|
|
|
|
|
|
<style></style>
|