]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/commitdiff
Make breadcrumbs clickable
authorJohannes <johannes@cloudron.io>
Sun, 6 Nov 2016 14:37:30 +0000 (15:37 +0100)
committerJohannes <johannes@cloudron.io>
Sun, 6 Nov 2016 14:37:36 +0000 (15:37 +0100)
Fixes #2

app/index.html
app/js/app.js

index 7faff43313c4fed9e648536ddee41e56c5435314..59fdcbf9b936d059863d52fe41e79a4defa86742 100644 (file)
             </div>
             <div class="col-lg-12">
                 <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">
-                        {{ part }}
+                        <a href="{{ part.link }}">{{ part.name }}</a>
                     </li>
                 </ol>
             </div>
index b26a2a6c037b86833af219b24521bd1834ca5d6a..739e9b12fb6842559f999aec584b752c52d1e4e5 100644 (file)
@@ -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;