Browse Source

Refactor group_linked macro to link_to_group

Makes it match up with the similar link_to_user change I made
previously, including also taking the Group object as the argument
instead of the path.
merge-requests/85/head
Deimos 5 years ago
parent
commit
3015b2eeff
  1. 4
      tildes/tildes/templates/bookmarks.jinja2
  2. 4
      tildes/tildes/templates/error_group_not_found.jinja2
  3. 4
      tildes/tildes/templates/groups.jinja2
  4. 4
      tildes/tildes/templates/macros/links.jinja2
  5. 4
      tildes/tildes/templates/macros/topics.jinja2
  6. 8
      tildes/tildes/templates/notifications_unread.jinja2
  7. 4
      tildes/tildes/templates/search.jinja2
  8. 2
      tildes/tildes/templates/topic.jinja2
  9. 6
      tildes/tildes/templates/topic_listing.jinja2
  10. 4
      tildes/tildes/templates/user.jinja2

4
tildes/tildes/templates/bookmarks.jinja2

@ -1,7 +1,7 @@
{% extends 'base_user_menu.jinja2' %} {% extends 'base_user_menu.jinja2' %}
{% from 'macros/comments.jinja2' import render_single_comment with context %} {% from 'macros/comments.jinja2' import render_single_comment with context %}
{% from 'macros/links.jinja2' import group_linked %}
{% from 'macros/links.jinja2' import link_to_group %}
{% from 'macros/topics.jinja2' import render_topic_for_listing with context %} {% from 'macros/topics.jinja2' import render_topic_for_listing with context %}
{% block title %}Bookmarks{% endblock %} {% block title %}Bookmarks{% endblock %}
@ -28,7 +28,7 @@
{% if post is topic %} {% if post is topic %}
{{ render_topic_for_listing(post, show_group=True) }} {{ render_topic_for_listing(post, show_group=True) }}
{% elif post is comment %} {% elif post is comment %}
<h2 class="heading-post-listing">Comment on <a href="{{ post.topic.permalink }}">{{ post.topic.title }}</a> in {{ group_linked(post.topic.group.path) }}</h2>
<h2 class="heading-post-listing">Comment on <a href="{{ post.topic.permalink }}">{{ post.topic.title }}</a> in {{ link_to_group(post.topic.group) }}</h2>
{{ render_single_comment(post) }} {{ render_single_comment(post) }}
{% endif %} {% endif %}
</li> </li>

4
tildes/tildes/templates/error_group_not_found.jinja2

@ -3,7 +3,7 @@
{% extends 'base_no_sidebar.jinja2' %} {% extends 'base_no_sidebar.jinja2' %}
{% from 'macros/links.jinja2' import group_linked %}
{% from 'macros/links.jinja2' import link_to_group %}
{% block title %} {% block title %}
Group not found Group not found
@ -17,7 +17,7 @@ Group not found
<p class="empty-subtitle">Did you mean one of these groups instead?</p> <p class="empty-subtitle">Did you mean one of these groups instead?</p>
<ul> <ul>
{% for group in group_suggestions %} {% for group in group_suggestions %}
<li>{{ group_linked(group) }}</li>
<li>{{ link_to_group(group) }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}

4
tildes/tildes/templates/groups.jinja2

@ -4,7 +4,7 @@
{% extends 'base_no_sidebar.jinja2' %} {% extends 'base_no_sidebar.jinja2' %}
{% from 'macros/groups.jinja2' import render_group_subscription_box with context %} {% from 'macros/groups.jinja2' import render_group_subscription_box with context %}
{% from 'macros/links.jinja2' import group_linked %}
{% from 'macros/links.jinja2' import link_to_group %}
{% block title %}Browse groups{% endblock %} {% block title %}Browse groups{% endblock %}
@ -24,7 +24,7 @@
{% for group in groups %} {% for group in groups %}
<tr class="group-level-{{ group.path|length - 1 }}"> <tr class="group-level-{{ group.path|length - 1 }}">
<td> <td>
{{ group_linked(group.path) }}
{{ link_to_group(group) }}
{% if group.short_description %} {% if group.short_description %}
<p class="group-list-description">{{ group.short_description }}</p> <p class="group-list-description">{{ group.short_description }}</p>
{% endif %} {% endif %}

4
tildes/tildes/templates/macros/links.jinja2

@ -9,6 +9,6 @@
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}
{% macro group_linked(group_path) -%}
<a href="/~{{ group_path }}" class="link-group">~{{ group_path }}</a>
{% macro link_to_group(group) -%}
<a href="/~{{ group.path }}" class="link-group">~{{ group.path }}</a>
{%- endmacro %} {%- endmacro %}

4
tildes/tildes/templates/macros/topics.jinja2

@ -2,7 +2,7 @@
{# SPDX-License-Identifier: AGPL-3.0-or-later #} {# SPDX-License-Identifier: AGPL-3.0-or-later #}
{% from 'macros/datetime.jinja2' import adaptive_date_responsive %} {% from 'macros/datetime.jinja2' import adaptive_date_responsive %}
{% from 'macros/links.jinja2' import group_linked, link_to_user %}
{% from 'macros/links.jinja2' import link_to_group, link_to_user %}
{% from 'utils.jinja2' import pluralize %} {% from 'utils.jinja2' import pluralize %}
{% macro render_topic_for_listing(topic, show_group=False, rank=None) %} {% macro render_topic_for_listing(topic, show_group=False, rank=None) %}
@ -31,7 +31,7 @@
<div class="topic-metadata"> <div class="topic-metadata">
{% if show_group %} {% if show_group %}
<span class="topic-group">{{ group_linked(topic.group.path) }}</span>
<span class="topic-group">{{ link_to_group(topic.group) }}</span>
{% endif %} {% endif %}
{% if topic.important_tags %} {% if topic.important_tags %}

8
tildes/tildes/templates/notifications_unread.jinja2

@ -4,7 +4,7 @@
{% extends 'base_user_menu.jinja2' %} {% extends 'base_user_menu.jinja2' %}
{% from 'macros/comments.jinja2' import comment_label_options_template, comment_reply_template, render_single_comment with context %} {% from 'macros/comments.jinja2' import comment_label_options_template, comment_reply_template, render_single_comment with context %}
{% from 'macros/links.jinja2' import group_linked %}
{% from 'macros/links.jinja2' import link_to_group %}
{% block title %}Unread notifications{% endblock %} {% block title %}Unread notifications{% endblock %}
@ -29,12 +29,12 @@
{% for notification in notifications: %} {% for notification in notifications: %}
<li> <li>
{% if notification.is_comment_reply %} {% if notification.is_comment_reply %}
<h2 class="heading-notification">Reply to your comment on <a href="{{ notification.comment.topic.permalink }}">{{ notification.comment.topic.title }}</a> in {{ group_linked(notification.comment.topic.group.path) }}</h2>
<h2 class="heading-notification">Reply to your comment on <a href="{{ notification.comment.topic.permalink }}">{{ notification.comment.topic.title }}</a> in {{ link_to_group(notification.comment.topic.group) }}</h2>
{% elif notification.is_topic_reply %} {% elif notification.is_topic_reply %}
<h2 class="heading-notification">Reply to your topic <a href="{{ notification.comment.topic.permalink }}">{{ notification.comment.topic.title }}</a> in {{ group_linked(notification.comment.topic.group.path) }}</h2>
<h2 class="heading-notification">Reply to your topic <a href="{{ notification.comment.topic.permalink }}">{{ notification.comment.topic.title }}</a> in {{ link_to_group(notification.comment.topic.group) }}</h2>
{% elif notification.is_mention %} {% elif notification.is_mention %}
<h2 class="heading-notification"> <h2 class="heading-notification">
You were mentioned in a comment on <a href="{{ notification.comment.topic.permalink }}">{{ notification.comment.topic.title }}</a> in {{ group_linked(notification.comment.topic.group.path) }}
You were mentioned in a comment on <a href="{{ notification.comment.topic.permalink }}">{{ notification.comment.topic.title }}</a> in {{ link_to_group(notification.comment.topic.group) }}
</h2> </h2>
{% endif %} {% endif %}

4
tildes/tildes/templates/search.jinja2

@ -4,7 +4,7 @@
{% extends 'topic_listing.jinja2' %} {% extends 'topic_listing.jinja2' %}
{% from 'macros/forms.jinja2' import search_form %} {% from 'macros/forms.jinja2' import search_form %}
{% from 'macros/links.jinja2' import group_linked %}
{% from 'macros/links.jinja2' import link_to_group %}
{% block title %}Search results for "{{ search }}"{% endblock %} {% block title %}Search results for "{{ search }}"{% endblock %}
@ -22,7 +22,7 @@
{% block filter_info %} {% block filter_info %}
{% if group %} {% if group %}
<div class="topic-listing-filter"> <div class="topic-listing-filter">
Search results from inside {{ group_linked(group.path) }} only.
Search results from inside {{ link_to_group(group) }} only.
<a href="{{ request.route_url("search", _query={"q": search}) }}">Search all groups</a> <a href="{{ request.route_url("search", _query={"q": search}) }}">Search all groups</a>
</div> </div>
{% endif %} {% endif %}

2
tildes/tildes/templates/topic.jinja2

@ -8,7 +8,7 @@
{% from 'macros/datetime.jinja2' import adaptive_date_responsive, time_ago %} {% from 'macros/datetime.jinja2' import adaptive_date_responsive, time_ago %}
{% from 'macros/forms.jinja2' import markdown_textarea %} {% from 'macros/forms.jinja2' import markdown_textarea %}
{% from 'macros/groups.jinja2' import group_segmented_link %} {% from 'macros/groups.jinja2' import group_segmented_link %}
{% from 'macros/links.jinja2' import group_linked, link_to_user %}
{% from 'macros/links.jinja2' import link_to_user %}
{% from 'macros/topics.jinja2' import topic_voting with context %} {% from 'macros/topics.jinja2' import topic_voting with context %}
{% from 'macros/utils.jinja2' import pluralize %} {% from 'macros/utils.jinja2' import pluralize %}

6
tildes/tildes/templates/topic_listing.jinja2

@ -5,7 +5,7 @@
{% from 'macros/forms.jinja2' import search_form %} {% from 'macros/forms.jinja2' import search_form %}
{% from 'macros/groups.jinja2' import group_segmented_link, render_group_subscription_box with context %} {% from 'macros/groups.jinja2' import group_segmented_link, render_group_subscription_box with context %}
{% from 'macros/links.jinja2' import group_linked %}
{% from 'macros/links.jinja2' import link_to_group %}
{% from 'macros/topics.jinja2' import render_topic_for_listing with context %} {% from 'macros/topics.jinja2' import render_topic_for_listing with context %}
{% block title %}Topics in ~{{ group.path }}{% endblock %} {% block title %}Topics in ~{{ group.path }}{% endblock %}
@ -99,7 +99,7 @@
<div class="topic-listing-filter"> <div class="topic-listing-filter">
{% if tag %} {% if tag %}
{% if is_single_group %} {% if is_single_group %}
Showing only topics in {{ group_linked(group.path) }} with the tag "{{ tag|replace('_', ' ') }}".
Showing only topics in {{ link_to_group(group) }} with the tag "{{ tag|replace('_', ' ') }}".
<a href="{{ request.current_listing_normal_url() }}">Back to normal view</a> / <a href="{{ request.current_listing_normal_url() }}">Back to normal view</a> /
<a href="{{ request.route_url("home", _query={"tag": tag}) }}"> <a href="{{ request.route_url("home", _query={"tag": tag}) }}">
{% if request.user %} {% if request.user %}
@ -225,7 +225,7 @@
<li>Subgroups</li> <li>Subgroups</li>
<ul class="nav"> <ul class="nav">
{% for subgroup in subgroups %} {% for subgroup in subgroups %}
<li class="nav-item">{{ group_linked(subgroup.path) }}</li>
<li class="nav-item">{{ link_to_group(subgroup) }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
</ul> </ul>

4
tildes/tildes/templates/user.jinja2

@ -4,7 +4,7 @@
{% extends 'base_user_menu.jinja2' %} {% extends 'base_user_menu.jinja2' %}
{% from 'macros/comments.jinja2' import comment_label_options_template, comment_reply_template, render_single_comment with context %} {% from 'macros/comments.jinja2' import comment_label_options_template, comment_reply_template, render_single_comment with context %}
{% from 'macros/links.jinja2' import group_linked %}
{% from 'macros/links.jinja2' import link_to_group %}
{% from 'macros/topics.jinja2' import render_topic_for_listing with context %} {% from 'macros/topics.jinja2' import render_topic_for_listing with context %}
{% block title %}User: {{ user.username }}{% endblock %} {% block title %}User: {{ user.username }}{% endblock %}
@ -108,7 +108,7 @@
{% else %} {% else %}
{{ post.topic.title }} {{ post.topic.title }}
{% endif %} {% endif %}
</a> in {{ group_linked(post.topic.group.path) }}</h2>
</a> in {{ link_to_group(post.topic.group) }}</h2>
{{ render_single_comment(post) }} {{ render_single_comment(post) }}
{% endif %} {% endif %}
</li> </li>

Loading…
Cancel
Save