Commit 51723cdf by Johannes

Make breadcrumbs clickable

Fixes #2
1 parent 5f43935e
Showing with 9 additions and 6 deletions
...@@ -116,9 +116,9 @@ ...@@ -116,9 +116,9 @@
</div> </div>
<div class="col-lg-12"> <div class="col-lg-12">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><i class="fa fa-home"></i>&nbsp;</li> <li><a href="#/"><i class="fa fa-home"></i>&nbsp;</a></li>
<li v-for="part in pathParts"> <li v-for="part in pathParts">
{{ part }} <a href="{{ part.link }}">{{ part.name }}</a>
</li> </li>
</ol> </ol>
</div> </div>
......
...@@ -77,9 +77,7 @@ function loadDirectory(filePath) { ...@@ -77,9 +77,7 @@ function loadDirectory(filePath) {
filePath = filePath ? sanitize(filePath) : '/'; filePath = filePath ? sanitize(filePath) : '/';
console.log(filePath); superagent.get('/api/files/' + encode(filePath)).query({ username: app.session.username, password: app.session.password }).end(function (error, result) {
superagent.get('/api/files/' + filePath).query({ username: app.session.username, password: app.session.password }).end(function (error, result) {
app.busy = false; app.busy = false;
if (result && result.statusCode === 401) return logout(); if (result && result.statusCode === 401) return logout();
...@@ -91,7 +89,12 @@ function loadDirectory(filePath) { ...@@ -91,7 +89,12 @@ function loadDirectory(filePath) {
return entry; return entry;
}); });
app.path = filePath; app.path = filePath;
app.pathParts = decode(filePath).split('/').filter(function (e) { return !!e; }); app.pathParts = decode(filePath).split('/').filter(function (e) { return !!e; }).map(function (e, i, a) {
return {
name: e,
link: '#' + sanitize('/' + a.slice(0, i).join('/') + '/' + e)
};
});
// update in case this was triggered from code // update in case this was triggered from code
window.location.hash = app.path; window.location.hash = app.path;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!