...
 
......@@ -573,3 +573,18 @@ div#go-up a:hover {
.pagination .step-links.next {
float: right;
}
.pad-list--path, .pad-list--actions {
background: white;
position: sticky;
padding: .5em .2em;
}
.pad-list--path {
top: 2em;
}
.pad-list--actions {
bottom : 0;
}
\ No newline at end of file
......@@ -2,15 +2,16 @@
{% load wikify %}
{% block content %}
<section class="pad-list--path">
<a href="{% url 'manage' %}">root</a>
{% for name, path in crumbs %}
> <a href="{% url 'manage' path|pathString %}">{{ name }}</a>
{% endfor %}
</section>
<ul id="pads_list" class="manage_list">
{% for name, folder in tree.folders.items %}
<li><a href="{% url 'manage' name|addPath:folderPath %}">&#128448; {{ name }}</a></li>
{% for folder in folders %}
<li><a href="{% url 'manage' folder|addPath:folderPath %}">&#128448; {{ folder }}</a></li>
{% endfor %}
{% if folderPath %}
<li><a href="{% url 'pad-create' folderPath|pathString %}">+ create pad</a></li>
{% else %}
<li><a href="{% url 'pad-create' %}">+ create pad</a></li>
{% endif %}
{% for pad in tree.pads %}
<li>
<a data-uid="{{ pad.display_slug }}" href="{% url 'pad-write' slug=pad.display_slug %}" class="pad-link">
......@@ -28,4 +29,7 @@
</li>
{% endfor %}
</ul>
<section class="pad-list--actions">
<a href="{% url 'pad-create' %}">+ create pad</a>
</section>
{% endblock %}
\ No newline at end of file
......@@ -28,15 +28,16 @@ def stripPath(value, path):
@register.filter
def addPath(value, path):
return '{}{}'.format(pathString(path), value)
return '{}{}'.format(ensureTrailingSlash(pathString(path)), value)
@register.filter
def pathString(path):
if path is not None and len(path) > 0:
return '{}/'.format('/'.join(path))
return '{}'.format('/'.join(path))
return ''
def ensureTrailingSlash(path):
if path[-1] != '/':
return '{}/'.format(path)
if len(path) > 0:
if path[-1] != '/':
return '{}/'.format(path)
return path
\ No newline at end of file
......@@ -602,7 +602,13 @@ def manage(request, path=[]):
for key in path:
tree = tree['folders'][key]
return render(request, "manage-tree.html", {'tree': tree, 'folderPath': path })
crumbs = [(path[i], path[:i+1]) for i in range(len(path))]
folders = [key for key in tree['folders'].keys()]
folders.sort()
return render(request, "manage-tree.html", {'tree': tree, 'folderPath': path, 'crumbs': crumbs, 'folders': folders })
def all(request):
if request.user.is_authenticated:
......