Turn comments icon on search result into link to comments

Also cleans up torrent.id/torrent.meta.id
This commit is contained in:
TheAMM 2017-05-28 02:46:04 +03:00
parent f02836f75e
commit 32fa021f34
2 changed files with 7 additions and 6 deletions

View File

@ -70,20 +70,21 @@
</a>
</td>
<td colspan="2">
{% set torrent_id = torrent.meta.id if use_elastic else torrent.id %}
{% 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 '') }}">
<a href="{{ url_for('view_torrent', torrent_id=torrent_id, _anchor='comments') }}" 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>
</a>
{% 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>
<a href="{{ url_for('view_torrent', torrent_id=torrent_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>
<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 %}
<a href="{{ create_magnet_from_es_info(torrent.display_name, torrent.info_hash) }}"><i class="fa fa-fw fa-magnet"></i></a>
{% else %}

View File

@ -128,7 +128,7 @@
</div>
{% endif %}
<div class="panel panel-default">
<div id="comments" class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Comments - {{ comments | length }}