diff --git a/realms/modules/wiki/views.py b/realms/modules/wiki/views.py index 44144be..5d18168 100644 --- a/realms/modules/wiki/views.py +++ b/realms/modules/wiki/views.py @@ -103,12 +103,17 @@ def create(name): info={}) -@blueprint.route("/_index") -def index(): +@blueprint.route("/_index", defaults={"path": ""}) +@blueprint.route("/_index/") +def index(path): + items = g.current_wiki.get_index() + if path: + path = to_canonical(path) + "/" + items = (i for i in items if i['name'].startswith(path)) if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous(): return current_app.login_manager.unauthorized() - return render_template('wiki/index.html', index=g.current_wiki.get_index()) + return render_template('wiki/index.html', index=items, path=path) @blueprint.route("/", methods=['POST', 'PUT', 'DELETE']) diff --git a/realms/templates/wiki/index.html b/realms/templates/wiki/index.html index 304ed67..adb3dea 100644 --- a/realms/templates/wiki/index.html +++ b/realms/templates/wiki/index.html @@ -9,6 +9,7 @@ $(document).ready(function() { {% endblock %} {% block body %} +

Index of /{{ path }}

@@ -20,11 +21,11 @@ $(document).ready(function() { {% for file in index %} - + {% endfor %}
{{ file['name'] }}{{ file['name'][path|length:] }} {{ file['ctime']|datetime }}
-{% endblock %} \ No newline at end of file +{% endblock %}