mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 19:00:07 +00:00
Merge pull request #169 from sharkykh/num-comments
Add number of comments to torrent lists
This commit is contained in:
commit
ea17f2d4da
|
@ -25,6 +25,7 @@ def search_elastic(term='', user=None, sort='id', order='desc',
|
||||||
'id': 'id',
|
'id': 'id',
|
||||||
'size': 'filesize',
|
'size': 'filesize',
|
||||||
# 'name': 'display_name', # This is slow and buggy
|
# 'name': 'display_name', # This is slow and buggy
|
||||||
|
'comments': 'comments_count',
|
||||||
'seeders': 'seed_count',
|
'seeders': 'seed_count',
|
||||||
'leechers': 'leech_count',
|
'leechers': 'leech_count',
|
||||||
'downloads': 'download_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,
|
'size': models.Torrent.filesize,
|
||||||
# Disable this because we disabled this in search_elastic, for the sake of consistency:
|
# Disable this because we disabled this in search_elastic, for the sake of consistency:
|
||||||
# 'name': models.Torrent.display_name,
|
# 'name': models.Torrent.display_name,
|
||||||
|
'comments': models.Torrent.comment_count,
|
||||||
'seeders': models.Statistic.seed_count,
|
'seeders': models.Statistic.seed_count,
|
||||||
'leechers': models.Statistic.leech_count,
|
'leechers': models.Statistic.leech_count,
|
||||||
'downloads': models.Statistic.download_count
|
'downloads': models.Statistic.download_count
|
||||||
|
|
|
@ -62,6 +62,30 @@ table.torrent-list tbody tr td a:visited {
|
||||||
color: #1d4568;
|
color: #1d4568;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* comments count */
|
||||||
|
table.torrent-list .hdr-comments {
|
||||||
|
border-left: hidden;
|
||||||
|
font-size: medium;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.torrent-list .hdr-comments i {
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.torrent-list tbody .comments {
|
||||||
|
position: relative;
|
||||||
|
float: right;
|
||||||
|
border: 1px solid #d7d7d7;
|
||||||
|
border-radius: 3px;
|
||||||
|
color: #383838;
|
||||||
|
padding: 0 5px;
|
||||||
|
font-size: small;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
table.torrent-list tbody .comments i {
|
||||||
|
padding-right: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
#torrent-description img {
|
#torrent-description img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
{% call render_column_header("hdr-name", "width:auto;") %}
|
{% call render_column_header("hdr-name", "width:auto;") %}
|
||||||
<div>Name</div>
|
<div>Name</div>
|
||||||
{% endcall %}
|
{% 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) %}
|
{% call render_column_header("hdr-link", "width:70px;", center_text=True) %}
|
||||||
<div>Link</div>
|
<div>Link</div>
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
@ -44,12 +47,10 @@
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
{% call render_column_header("hdr-leechers", "width:50px;", center_text=True, sort_key="leechers", header_title="Leeches") %}
|
{% 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>
|
<i class="fa fa-arrow-down" aria-hidden="true"></i>
|
||||||
|
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
{% call render_column_header("hdr-downloads", "width:50px;", center_text=True, sort_key="downloads", header_title="Completed downloads") %}
|
{% 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>
|
<i class="fa fa-check" aria-hidden="true"></i>
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -68,12 +69,20 @@
|
||||||
<img src="/static/img/icons/{{ icon_dir }}/{{ cat_id }}.png" alt="{{ category_name(cat_id) }}">
|
<img src="/static/img/icons/{{ icon_dir }}/{{ cat_id }}.png" alt="{{ category_name(cat_id) }}">
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
{% if use_elastic %}
|
<td colspan="2">
|
||||||
<td><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></td>
|
{% set com_count = torrent.comment_count %}
|
||||||
{% else %}
|
{% if com_count %}
|
||||||
<td><a href="{{ url_for('view_torrent', torrent_id=torrent.id) }}" title="{{ torrent.display_name | escape }}">{{ torrent.display_name | escape }}</a></td>
|
<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 %}
|
{% endif %}
|
||||||
<td style="white-space: nowrap;text-align: center;">
|
{% 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 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 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 %}
|
{% 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>
|
<a href="{{ create_magnet_from_es_info(torrent.display_name, torrent.info_hash) }}"><i class="fa fa-fw fa-magnet"></i></a>
|
||||||
|
|
Loading…
Reference in a new issue