1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 16:29:59 +00:00

Nicer looking file list (basic table)

This commit is contained in:
sharkykh 2017-05-15 09:10:31 +03:00
parent c5d77f996b
commit dd1f1b6834
2 changed files with 28 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

@ -85,13 +85,26 @@
<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 %}
{%- if value is iterable %}
{%- if loop.depth0 is greaterthan 0 %}
<tr> <tr>
<td>{{ key }}</td> <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> <td class="col-md-2">{{ value | filesizeformat(True) }}</td>
</tr> </tr>
{%- endif %}
{%- endfor %} {%- endfor %}
<tbody>
</table> </table>
</div> </div>
</div> </div>