Support getting indexs of subdirs
This commit is contained in:
parent
853630646e
commit
c70480c917
|
@ -103,12 +103,17 @@ def create(name):
|
|||
info={})
|
||||
|
||||
|
||||
@blueprint.route("/_index")
|
||||
def index():
|
||||
@blueprint.route("/_index", defaults={"path": ""})
|
||||
@blueprint.route("/_index/<path:path>")
|
||||
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("/<path:name>", methods=['POST', 'PUT', 'DELETE'])
|
||||
|
|
|
@ -9,6 +9,7 @@ $(document).ready(function() {
|
|||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h2>Index of /{{ path }}</h2>
|
||||
<table class="table table-bordered data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -20,7 +21,7 @@ $(document).ready(function() {
|
|||
</thead>
|
||||
{% for file in index %}
|
||||
<tr>
|
||||
<td><a href="{{ url_for('wiki.page', name=file['name']) }}">{{ file['name'] }}</a></td>
|
||||
<td><a href="{{ url_for('wiki.page', name=file['name']) }}">{{ file['name'][path|length:] }}</a></td>
|
||||
<td class="hidden-xs">{{ file['size'] }}</td>
|
||||
<td>{{ file['ctime']|datetime }}</td>
|
||||
<td class="hidden-xs hidden-sm">{{ file['mtime']|datetime }}</td>
|
||||
|
|
Loading…
Reference in a new issue