From 33d47771019f17dbf21b3afdb0c3e934c3b67e1c Mon Sep 17 00:00:00 2001 From: oupala Date: Tue, 28 May 2019 14:59:25 +0200 Subject: [PATCH 1/2] 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. --- apaxy/theme/apaxy.js | 26 ++++++++++++++++++++++++++ apaxy/theme/header.html | 3 +++ 2 files changed, 29 insertions(+) diff --git a/apaxy/theme/apaxy.js b/apaxy/theme/apaxy.js index f6ea87d..b2e70c6 100644 --- a/apaxy/theme/apaxy.js +++ b/apaxy/theme/apaxy.js @@ -74,3 +74,29 @@ if (uri.substring(uri.length - 1) !== '/') { }); })(document); + +// generate a breadcrumb +var uri = window.location.pathname.substr(1); +var arr = uri.split('/'); +var url = "" +var bread = '
  • Home
  • '; +var cont = 1; +arr.forEach(function(value){ + url = url + '/' + value; + if(value != ''){ + if(arr.length == cont+1) + bread += "
  • "+decodeURI(value)+"
  • "; + else + bread += "
  • "+decodeURI(value)+"
  • "; + } + 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); + } +} diff --git a/apaxy/theme/header.html b/apaxy/theme/header.html index 08db323..297a9f0 100644 --- a/apaxy/theme/header.html +++ b/apaxy/theme/header.html @@ -1,4 +1,7 @@
    + + From 4d61aab05870b4ecdba98134e95afdd7af0b78d6 Mon Sep 17 00:00:00 2001 From: oupala Date: Wed, 29 May 2019 14:31:44 +0200 Subject: [PATCH 2/2] feat: css styling for breadcrumb Add cdd styling inspired from the following website: https://css-tricks.com/triangle-breadcrumbs/ --- apaxy/theme/apaxy.js | 2 +- apaxy/theme/header.html | 2 +- apaxy/theme/style.css | 50 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/apaxy/theme/apaxy.js b/apaxy/theme/apaxy.js index b2e70c6..608b377 100644 --- a/apaxy/theme/apaxy.js +++ b/apaxy/theme/apaxy.js @@ -91,7 +91,7 @@ arr.forEach(function(value){ } cont++; }); -document.getElementById("breadcrumbs").innerHTML = bread; +document.getElementById("breadcrumb").innerHTML = bread; if (uri.substring(uri.length-1) != '/'){ var indexes = document.getElementsByClassName('indexcolname'), i = indexes.length; diff --git a/apaxy/theme/header.html b/apaxy/theme/header.html index 297a9f0..1c30e70 100644 --- a/apaxy/theme/header.html +++ b/apaxy/theme/header.html @@ -1,7 +1,7 @@
    -