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

Update style

Add support for sorting comments (in advance),
add th for sorting by comments_count, add title to the counter box and fix it being under the torrent's name,
This commit is contained in:
Kfir Hadas 2017-05-25 17:56:06 +03:00
parent 90695cad11
commit aad5a0c6ea
3 changed files with 20 additions and 6 deletions

View file

@ -25,6 +25,7 @@ def search_elastic(term='', user=None, sort='id', order='desc',
'id': 'id',
'size': 'filesize',
# 'name': 'display_name', # This is slow and buggy
'comments': 'comments_count',
'seeders': 'seed_count',
'leechers': 'leech_count',
'downloads': 'download_count'
@ -190,6 +191,7 @@ def search_db(term='', user=None, sort='id', order='desc', category='0_0',
'size': models.Torrent.filesize,
# Disable this because we disabled this in search_elastic, for the sake of consistency:
# 'name': models.Torrent.display_name,
'comments': models.Torrent.comment_count,
'seeders': models.Statistic.seed_count,
'leechers': models.Statistic.leech_count,
'downloads': models.Statistic.download_count

View file

@ -62,12 +62,18 @@ table.torrent-list tbody tr td a:visited {
color: #1d4568;
}
/* comments count */
table.torrent-list .hdr-comments {
border-left: hidden;
}
table.torrent-list tbody .comments {
position: relative;
float: right;
border: 1px solid #d7d7d7;
border-radius: 3px;
color: #383838;
padding: 0 5px 0 5px;
padding: 1px 5px;
background-color: #ffffff;
}
table.torrent-list tbody .comments i {

View file

@ -28,6 +28,9 @@
{% call render_column_header("hdr-name", "width:auto;") %}
<div>Name</div>
{% endcall %}
{% call render_column_header("hdr-comments", "width:50px;", center_text=True, sort_key="comments", header_title="Comments") %}
<i class="fa fa-comments-o"></i>
{% endcall %}
{% call render_column_header("hdr-link", "width:70px;", center_text=True) %}
<div>Link</div>
{% endcall %}
@ -44,12 +47,10 @@
{% endcall %}
{% call render_column_header("hdr-leechers", "width:50px;", center_text=True, sort_key="leechers", header_title="Leeches") %}
<i class="fa fa-arrow-down" aria-hidden="true"></i>
{% endcall %}
{% call render_column_header("hdr-downloads", "width:50px;", center_text=True, sort_key="downloads", header_title="Completed downloads") %}
<i class="fa fa-check" aria-hidden="true"></i>
{% endcall %}
{% endif %}
</tr>
</thead>
@ -68,15 +69,20 @@
<img src="/static/img/icons/{{ icon_dir }}/{{ cat_id }}.png" alt="{{ category_name(cat_id) }}">
</a>
</td>
<td>
{% if torrent.comments %}<span class="comments"><i class="fa fa-comments-o"></i>{{ torrent.comments | length }}</span>{% endif %}
<td colspan="2">
{% set com_count = torrent.comment_count %}
{% if com_count %}
<span class="comments" title="{{ '{c} comment{s}'.format(c=com_count, s='s' if com_count > 1 else '') }}">
<i class="fa fa-comments-o"></i>{{ com_count -}}
</span>
{% endif %}
{% if use_elastic %}
<a href="{{ url_for('view_torrent', torrent_id=torrent.meta.id) }}" title="{{ torrent.display_name | escape }}">{%if "highlight" in torrent.meta %}{{ torrent.meta.highlight.display_name[0] | safe }}{% else %}{{torrent.display_name}}{%endif%}</a>
{% else %}
<a href="{{ url_for('view_torrent', torrent_id=torrent.id) }}" title="{{ torrent.display_name | escape }}">{{ torrent.display_name | escape }}</a>
{% endif %}
</td>
<td style="white-space: nowrap;text-align: center;">
<td class="text-center" style="white-space: nowrap;">
{% if torrent.has_torrent %}<a href="{{ url_for('download_torrent', torrent_id=torrent.id) }}"><i class="fa fa-fw fa-download"></i></a>{% endif %}
{% if use_elastic %}
<a href="{{ create_magnet_from_es_info(torrent.display_name, torrent.info_hash) }}"><i class="fa fa-fw fa-magnet"></i></a>