path tree

This commit is contained in:
dave 2019-06-01 23:32:40 -07:00
parent eed6a102e7
commit 7877b04e66
3 changed files with 18 additions and 2 deletions

View File

@ -11,6 +11,7 @@ body {
}
h1 {
word-wrap: break-word;
margin: 0 0 0.5em 0;
}
a {
color: #4dF;
@ -28,6 +29,10 @@ div#header {
div#key {
float: left;
width: 30%;
ul.tree {
list-style: none;
padding: 0px 0px 0px 10px;
}
}
div#svg-container {
float: right;

View File

@ -63,7 +63,7 @@ class AppWeb(object):
except (ValueError, KeyError):
raise cherrypy.HTTPError(404)
page = self.render("page.html", node=node)
page = self.render("page.html", node=node, root=self.db.root)
dur = time() - start
return page + f"\n<!-- render time: {round(dur, 4)} -->"

View File

@ -13,7 +13,18 @@
<body onload="Application.boot();">
<div id="header">
<div id="key">
<h1>{{ node.path|pathjoin }}</h1>
<h1>{{ root.path|pathjoin }}</h1>
{% macro tree(parts) %}{% if parts|len > 0 %}
<ul class="tree">
<li>
<div>
<span>{{ parts[0] }}</span>
{{ tree(parts[1:]) }}
</div>
</li>
</ul>
{% endif %}{% endmacro %}
{{ tree(node.path[1:]) }}
<div>
<ul>
<li><strong>Controls:</strong> {% if node.parent %}<a href="/?n={{ node.parent|id }}">up</a>{% else %}up{% endif %}</li>