diff --git a/nyaa/search.py b/nyaa/search.py index 9e22f84..4db2879 100644 --- a/nyaa/search.py +++ b/nyaa/search.py @@ -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 diff --git a/nyaa/static/css/main.css b/nyaa/static/css/main.css index 3368282..4d70ea0 100755 --- a/nyaa/static/css/main.css +++ b/nyaa/static/css/main.css @@ -62,6 +62,30 @@ table.torrent-list tbody tr td a:visited { 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 { max-width: 100%; } diff --git a/nyaa/templates/search_results.html b/nyaa/templates/search_results.html index f4c5ff2..bcdc0b3 100644 --- a/nyaa/templates/search_results.html +++ b/nyaa/templates/search_results.html @@ -28,6 +28,9 @@ {% call render_column_header("hdr-name", "width:auto;") %}
Name
{% endcall %} + {% call render_column_header("hdr-comments", "width:50px;", center_text=True, sort_key="comments", header_title="Comments") %} + + {% endcall %} {% call render_column_header("hdr-link", "width:70px;", center_text=True) %}
Link
{% endcall %} @@ -44,12 +47,10 @@ {% endcall %} {% call render_column_header("hdr-leechers", "width:50px;", center_text=True, sort_key="leechers", header_title="Leeches") %} - {% endcall %} {% call render_column_header("hdr-downloads", "width:50px;", center_text=True, sort_key="downloads", header_title="Completed downloads") %} {% endcall %} - {% endif %} @@ -68,12 +69,20 @@ {{ category_name(cat_id) }} - {% if use_elastic %} - {%if "highlight" in torrent.meta %}{{ torrent.meta.highlight.display_name[0] | safe }}{% else %}{{torrent.display_name}}{%endif%} - {% else %} - {{ torrent.display_name | escape }} - {% endif %} - + + {% set com_count = torrent.comment_count %} + {% if com_count %} + + {{ com_count -}} + + {% endif %} + {% if use_elastic %} + {%if "highlight" in torrent.meta %}{{ torrent.meta.highlight.display_name[0] | safe }}{% else %}{{torrent.display_name}}{%endif%} + {% else %} + {{ torrent.display_name | escape }} + {% endif %} + + {% if torrent.has_torrent %}{% endif %} {% if use_elastic %}