mirror of
https://github.com/oupala/apaxy.git
synced 2025-08-12 13:43:59 +02:00
feat: add a breadcrumb
Add a breadcrumb to tell the user where he is in the tree. js and html is there and working. It needs some css styling though.
This commit is contained in:
@@ -74,3 +74,29 @@ if (uri.substring(uri.length - 1) !== '/') {
|
|||||||
});
|
});
|
||||||
|
|
||||||
})(document);
|
})(document);
|
||||||
|
|
||||||
|
// generate a breadcrumb
|
||||||
|
var uri = window.location.pathname.substr(1);
|
||||||
|
var arr = uri.split('/');
|
||||||
|
var url = ""
|
||||||
|
var bread = '<li><strong><a href="/">Home</a></strong></li>';
|
||||||
|
var cont = 1;
|
||||||
|
arr.forEach(function(value){
|
||||||
|
url = url + '/' + value;
|
||||||
|
if(value != ''){
|
||||||
|
if(arr.length == cont+1)
|
||||||
|
bread += "<li class='active'>"+decodeURI(value)+"</li>";
|
||||||
|
else
|
||||||
|
bread += "<li><a href='"+url+"'>"+decodeURI(value)+"</a></li>";
|
||||||
|
}
|
||||||
|
cont++;
|
||||||
|
});
|
||||||
|
document.getElementById("breadcrumbs").innerHTML = bread;
|
||||||
|
if (uri.substring(uri.length-1) != '/'){
|
||||||
|
var indexes = document.getElementsByClassName('indexcolname'),
|
||||||
|
i = indexes.length;
|
||||||
|
while (i--){
|
||||||
|
var a = indexes[i].getElementsByTagName('a')[0];
|
||||||
|
a.href = uri + '/' + a.getAttribute('href',2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<!-- we open the `wrapper` element here, but close it in the `footer.html` file -->
|
<!-- we open the `wrapper` element here, but close it in the `footer.html` file -->
|
||||||
|
|
||||||
|
<ol class="breadcrumb" id="breadcrumbs">
|
||||||
|
</ol>
|
||||||
|
|
||||||
<input type="search" id="filter" placeholder="filter contents" />
|
<input type="search" id="filter" placeholder="filter contents" />
|
||||||
|
Reference in New Issue
Block a user