Merge pull request #66 from sharkykh/improve-file-list

Improve file list with directories and icons
This commit is contained in:
Anna-Maria Meriniemi 2017-05-15 09:42:19 +03:00 committed by GitHub
commit 7b78bcc80b
2 changed files with 21 additions and 15 deletions

View File

@ -504,7 +504,7 @@ def view_torrent(torrent_id):
files = None files = None
if torrent.filelist: 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, return flask.render_template('view.html', torrent=torrent,
files=files, files=files,

View File

@ -79,20 +79,26 @@
</div> </div>
<div class="panel-collapse collapse" id="collapseFileList"> <div class="panel-collapse collapse" id="collapseFileList">
<table class="table table-bordered table-hover table-striped"> <table class="table table-bordered table-hover table-striped">
<thead> <thead>
<th style="width:auto;">Path</th> <th style="width:auto;">Path</th>
<th style="width:auto;">Size</th> <th style="width:auto;">Size</th>
</thead> </thead>
<tbody> <tbody>
{%- for key, value in files.items() %} {%- for key, value in files.items() recursive %}
<tr> <tr>
<td>{{ key }}</td> {%- if value is iterable %}
<td class="col-md-2">{{ value | filesizeformat(True) }}</td> <td colspan="2" {% if loop.depth0 is greaterthan 0 %}style="padding-left: {{ loop.depth0 * 20 }}px"{% endif %}>
</tr> <i class="glyphicon glyphicon-folder-open"></i> <b>{{ key }}</b></td>
{%- endfor %} {{ loop(value.items()) }}
<tbody> {%- else %}
</table> <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>
{%- endif %}
</tr>
{%- endfor %}
</table>
</div> </div>
</div> </div>
{% elif files %} {% elif files %}