Skip to content

Commit 7252eaf

Browse files
committed
working breadcrumbs
1 parent 87e0ebe commit 7252eaf

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

app/javascript/vue_components/file_browser.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
<template>
2-
{{ displayedFolders }}
3-
<div class="breadcrumb-list">
4-
<div v-for="(path, i) in displayedFolders">
2+
<ol class="breadcrumb-list">
3+
<li v-for="(path, i) in displayedFolders" @mousedown="onClickBreadcrumb(path)">
54
{{ path.name }}
6-
{{ path.id }}
7-
</div>
8-
</div>
5+
</li>
6+
</ol>
97
<div class="table project-files">
108
<div class="file-browser">
119
<table class="project-contents">
@@ -106,6 +104,14 @@ async function onClickCollection(file) {
106104
displayedFolders.value.push({id: file.id, path: file.path, name: file.name});
107105
isLoadingFiles.value = false;
108106
}
107+
108+
async function onClickBreadcrumb(path) {
109+
isLoadingFiles.value = true;
110+
displayedFiles.value = await loadFiles(path.id);
111+
const path_index = displayedFolders.value.indexOf(path);
112+
displayedFolders.value = displayedFolders.value.slice(0,path_index+1);
113+
isLoadingFiles.value = false;
114+
}
109115
</script>
110116
<style>
111117
.browser-collection {

0 commit comments

Comments
 (0)