Jump directly to comments when returning to topic

If a user has topic visit-tracking enabled, this makes it so that the
comments link will jump directly to the comments section when returning
to a topic that they've visited previously. This is mostly useful with
long text topics so you don't always have to scroll past all the text.

It might also be good to apply this to the title link for text topics,
but I'm not sure if many people click on that with the bright "(x new)"
drawing their attention.
This commit is contained in:
Deimos
2019-08-13 17:45:22 -06:00
parent a34b37f52f
commit 13720ff266

View File

@@ -63,12 +63,17 @@
<footer class="topic-info">
<div class="topic-info-comments">
<a
{% if topic.comments_since_last_visit %}
href="{{ topic.permalink }}#comments"
{% else %}
href="{{ topic.permalink }}"
{% endif %}
{% if request.user.open_new_tab_internal %}target="_blank"{% endif %}
>
{{ pluralize(topic.num_comments, "comment") }}
{% if topic.comments_since_last_visit is defined and topic.comments_since_last_visit %}
{% if topic.comments_since_last_visit %}
<span class="topic-info-comments-new" title="Last visit {{ topic.last_visit_time|ago }}">
({{ topic.comments_since_last_visit }} new)
</span>