mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 05:40:01 +00:00
Nicer looking file list (basic table)
This commit is contained in:
parent
c5d77f996b
commit
dd1f1b6834
|
@ -504,7 +504,7 @@ def view_torrent(torrent_id):
|
|||
|
||||
files = None
|
||||
if torrent.filelist:
|
||||
files = utils.flattenDict(json.loads(torrent.filelist.filelist_blob.decode('utf-8')))
|
||||
files = json.loads(torrent.filelist.filelist_blob.decode('utf-8'))
|
||||
|
||||
return flask.render_template('view.html', torrent=torrent,
|
||||
files=files,
|
||||
|
|
|
@ -79,20 +79,33 @@
|
|||
</div>
|
||||
|
||||
<div class="panel-collapse collapse" id="collapseFileList">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<thead>
|
||||
<th style="width:auto;">Path</th>
|
||||
<th style="width:auto;">Size</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{%- for key, value in files.items() %}
|
||||
<tr>
|
||||
<td>{{ key }}</td>
|
||||
<td class="col-md-2">{{ value | filesizeformat(True) }}</td>
|
||||
</tr>
|
||||
{%- endfor %}
|
||||
<tbody>
|
||||
</table>
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<thead>
|
||||
<th style="width:auto;">Path</th>
|
||||
<th style="width:auto;">Size</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{%- for key, value in files.items() recursive %}
|
||||
{%- if value is iterable %}
|
||||
{%- if loop.depth0 is greaterthan 0 %}
|
||||
<tr>
|
||||
<td colspan="2" style="padding-left: {{ loop.depth0 * 20 }}px">
|
||||
{%- else %}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{%- endif %}
|
||||
<i class="glyphicon glyphicon-folder-open"></i> <b>{{ key }}</b></td>
|
||||
{{ loop(value.items()) }}
|
||||
</tr>
|
||||
{%- else %}
|
||||
<tr>
|
||||
<td style="padding-left: {{ loop.depth0 * 20 }}px">
|
||||
<i class="glyphicon glyphicon-file"></i> {{ key }}</td>
|
||||
<td class="col-md-2">{{ value | filesizeformat(True) }}</td>
|
||||
</tr>
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% elif files %}
|
||||
|
|
Loading…
Reference in a new issue