Browse Source

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.
merge-requests/77/head
Deimos 5 years ago
parent
commit
13720ff266
  1. 7
      tildes/tildes/templates/macros/topics.jinja2

7
tildes/tildes/templates/macros/topics.jinja2

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

Loading…
Cancel
Save