aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes <johannes@cloudron.io>2016-11-06 15:37:30 +0100
committerJohannes <johannes@cloudron.io>2016-11-06 15:37:36 +0100
commit51723cdf2904a4341591c163cb119a80b0c26542 (patch)
tree57be0c81a31a15d1b3567a104b3ee634abe6417a
parent5f43935e567855125be9ffae1108cb6212cb8d93 (diff)
downloadSurfer-51723cdf2904a4341591c163cb119a80b0c26542.tar.gz
Surfer-51723cdf2904a4341591c163cb119a80b0c26542.tar.zst
Surfer-51723cdf2904a4341591c163cb119a80b0c26542.zip
Make breadcrumbs clickable
Fixes #2
-rw-r--r--app/index.html4
-rw-r--r--app/js/app.js11
2 files changed, 9 insertions, 6 deletions
diff --git a/app/index.html b/app/index.html
index 7faff43..59fdcbf 100644
--- a/app/index.html
+++ b/app/index.html
@@ -116,9 +116,9 @@
116 </div> 116 </div>
117 <div class="col-lg-12"> 117 <div class="col-lg-12">
118 <ol class="breadcrumb"> 118 <ol class="breadcrumb">
119 <li><i class="fa fa-home"></i>&nbsp;</li> 119 <li><a href="#/"><i class="fa fa-home"></i>&nbsp;</a></li>
120 <li v-for="part in pathParts"> 120 <li v-for="part in pathParts">
121 {{ part }} 121 <a href="{{ part.link }}">{{ part.name }}</a>
122 </li> 122 </li>
123 </ol> 123 </ol>
124 </div> 124 </div>
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) {
77 77
78 filePath = filePath ? sanitize(filePath) : '/'; 78 filePath = filePath ? sanitize(filePath) : '/';
79 79
80 console.log(filePath); 80 superagent.get('/api/files/' + encode(filePath)).query({ username: app.session.username, password: app.session.password }).end(function (error, result) {
81
82 superagent.get('/api/files/' + filePath).query({ username: app.session.username, password: app.session.password }).end(function (error, result) {
83 app.busy = false; 81 app.busy = false;
84 82
85 if (result && result.statusCode === 401) return logout(); 83 if (result && result.statusCode === 401) return logout();
@@ -91,7 +89,12 @@ function loadDirectory(filePath) {
91 return entry; 89 return entry;
92 }); 90 });
93 app.path = filePath; 91 app.path = filePath;
94 app.pathParts = decode(filePath).split('/').filter(function (e) { return !!e; }); 92 app.pathParts = decode(filePath).split('/').filter(function (e) { return !!e; }).map(function (e, i, a) {
93 return {
94 name: e,
95 link: '#' + sanitize('/' + a.slice(0, i).join('/') + '/' + e)
96 };
97 });
95 98
96 // update in case this was triggered from code 99 // update in case this was triggered from code
97 window.location.hash = app.path; 100 window.location.hash = app.path;