From 51723cdf2904a4341591c163cb119a80b0c26542 Mon Sep 17 00:00:00 2001 From: Johannes Date: Sun, 6 Nov 2016 15:37:30 +0100 Subject: Make breadcrumbs clickable Fixes #2 --- app/js/app.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'app/js/app.js') diff --git a/app/js/app.js b/app/js/app.js index b26a2a6..739e9b1 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -77,9 +77,7 @@ function loadDirectory(filePath) { filePath = filePath ? sanitize(filePath) : '/'; - console.log(filePath); - - superagent.get('/api/files/' + filePath).query({ username: app.session.username, password: app.session.password }).end(function (error, result) { + superagent.get('/api/files/' + encode(filePath)).query({ username: app.session.username, password: app.session.password }).end(function (error, result) { app.busy = false; if (result && result.statusCode === 401) return logout(); @@ -91,7 +89,12 @@ function loadDirectory(filePath) { return entry; }); 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 window.location.hash = app.path; -- cgit v1.2.3