Skip to content

Commit

Permalink
Refactorise les URLs du forum (#6295)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud-D authored Jul 15, 2022
1 parent 837c2f1 commit 143537e
Show file tree
Hide file tree
Showing 32 changed files with 431 additions and 387 deletions.
2 changes: 1 addition & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@

{# RSS links #}
{% with request.GET|yesno:'?,'|add:request.GET.urlencode as rss_params %}
<link rel="alternate" type="application/rss+xml" title="Forum" href="{% url "post-feed-rss" %}{{ rss_params | safe }}">
<link rel="alternate" type="application/rss+xml" title="Forum" href="{% url "forum:post-feed-rss" %}{{ rss_params | safe }}">
<link rel="alternate" type="application/rss+xml" title="Nouveaux tutoriels (RSS)" href="{% url "tutorial:feed-rss" %}{{ rss_params | safe }}">
<link rel="alternate" type="application/atom+xml" title="Nouveaux tutoriels (ATOM)" href="{% url "tutorial:feed-atom" %}{{ rss_params | safe }}">
<link rel="alternate" type="application/rss+xml" title="Nouveaux articles (RSS)" href="{% url "article:feed-rss" %}{{ rss_params | safe }}">
Expand Down
4 changes: 2 additions & 2 deletions templates/forum/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

{% block breadcrumb_base %}
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="{% url "cats-forums-list" %}" itemprop="url">
<a href="{% url "forum:cats-forums-list" %}" itemprop="url">
<span itemprop="title">{% trans "Forums" %}</span>
</a>
</li>
Expand Down Expand Up @@ -87,7 +87,7 @@ <h4>{{ period|humane_delta }}</h4>
<ul>
{% for topic in topics %}
<li>
<form action="{% url 'topic-edit' %}" method="post">
<form action="{% url "forum:topic-edit" %}" method="post">
<input type="hidden" name="topic" value="{{ topic.pk }}">
<input type="hidden" name="page" value="{% if page %} {{ page }} {% else %} 1 {% endif %}">
<input type="hidden" name="follow" value="1">
Expand Down
14 changes: 7 additions & 7 deletions templates/forum/category/forum.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

{% block new_btn %}
{% if user.profile.can_write_now %}
<a href="{% url 'topic-new' %}?forum={{ forum.pk }}" class="new-btn ico-after more blue">
<a href="{% url "forum:topic-new" %}?forum={{ forum.pk }}" class="new-btn ico-after more blue">
{% trans "Nouveau sujet" %}
</a>
{% endif %}
Expand Down Expand Up @@ -107,7 +107,7 @@
{% block sidebar_actions %}
<li>
{% with forum_is_followed=forum|is_followed_for_new_topic %}
{% url 'forum-topics-list' forum.category.slug forum.slug as link_follow %}
{% url "forum:topics-list" forum.category.slug forum.slug as link_follow %}
{% if forum_is_followed %}
{% trans "Suivre ce forum" as data_onclick %}
{% trans "Ne plus suivre ce forum" as button_text %}
Expand All @@ -121,7 +121,7 @@

<li>
{% with forum_is_email_followed=forum|is_email_followed_for_new_topic %}
{% url 'forum-topics-list' forum.category.slug forum.slug as link_follow %}
{% url "forum:topics-list" forum.category.slug forum.slug as link_follow %}
{% if forum_is_email_followed %}
{% trans "Être notifié par courriel" as data_onclick %}
{% trans "Ne plus être notifié par courriel" as button_text %}
Expand All @@ -140,29 +140,29 @@
<h3>{% trans "Filtres" %}</h3>
<ul>
<li>
<a href="{% url "forum-topics-list" forum.category.slug forum.slug %}?filter=solve"
<a href="{% url "forum:topics-list" forum.category.slug forum.slug %}?filter=solve"
class="ico-after tick green {% if request.GET.filter == "solve" %}selected{% endif %}"
>
{% trans "Sujets résolus" %}
</a>
</li>
<li>
<a href="{% url "forum-topics-list" forum.category.slug forum.slug %}?filter=unsolve"
<a href="{% url "forum:topics-list" forum.category.slug forum.slug %}?filter=unsolve"
class="ico-after tick blue {% if request.GET.filter == "unsolve" %}selected{% endif %}"
>
{% trans "Sujets non résolus" %}
</a>
</li>
<li>
<a href="{% url "forum-topics-list" forum.category.slug forum.slug %}?filter=noanswer"
<a href="{% url "forum:topics-list" forum.category.slug forum.slug %}?filter=noanswer"
class="ico-after view {% if request.GET.filter == "noanswer" %}selected{% endif %}"
>
{% trans "Sujets sans réponse" %}
</a>
</li>
{% if request.GET.filter %}
<li>
<a href="{% url "forum-topics-list" forum.category.slug forum.slug %}"
<a href="{% url "forum:topics-list" forum.category.slug forum.slug %}"
class="ico-after cross blue"
>
{% trans "Annuler le filtre" %}
Expand Down
2 changes: 1 addition & 1 deletion templates/forum/find/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{% with profile=usr|profile %}
<li><a href="{{ profile.get_absolute_url }}">{{ usr.username }}</a></li>
{% endwith %}
<li><a href="{% url 'post-find' usr.pk %}">{% trans "Messages postés" %}</a></li>
<li><a href="{% url "forum:post-find" usr.pk %}">{% trans "Messages postés" %}</a></li>
<li>{% trans "Recherche" %}</li>
{% endblock %}

Expand Down
12 changes: 6 additions & 6 deletions templates/forum/find/topic_by_tag.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
{% block sidebar_actions %}
<li>
{% with tag_is_followed=tag|is_followed_for_new_topic %}
{% url 'topic-tag-find' tag.slug as link_follow %}
{% url "forum:topic-tag-find" tag.slug as link_follow %}
{% if tag_is_followed %}
{% trans "Suivre ce tag" as data_onclick %}
{% trans "Ne plus suivre ce tag" as button_text %}
Expand All @@ -54,7 +54,7 @@
</li>
<li>
{% with tag_is_email_followed=tag|is_email_followed_for_new_topic %}
{% url 'topic-tag-find' tag.slug as link_follow %}
{% url "forum:topic-tag-find" tag.slug as link_follow %}
{% if tag_is_email_followed %}
{% trans "Être notifié par courriel" as data_onclick %}
{% trans "Ne plus être notifié par courriel" as button_text %}
Expand All @@ -73,29 +73,29 @@
<h3>{% trans "Filtres" %}</h3>
<ul>
<li>
<a href="{% url 'topic-tag-find' tag.slug %}?filter=solve"
<a href="{% url "forum:topic-tag-find" tag.slug %}?filter=solve"
class="ico-after tick green {% if request.GET.filter == "solve" %}selected{% endif %}"
>
{% trans "Sujets résolus" %}
</a>
</li>
<li>
<a href="{% url 'topic-tag-find' tag.slug %}?filter=unsolve"
<a href="{% url "forum:topic-tag-find" tag.slug %}?filter=unsolve"
class="ico-after tick blue {% if request.GET.filter == "unsolve" %}selected{% endif %}"
>
{% trans "Sujets non résolus" %}
</a>
</li>
<li>
<a href="{% url 'topic-tag-find' tag.slug %}?filter=noanswer"
<a href="{% url "forum:topic-tag-find" tag.slug %}?filter=noanswer"
class="ico-after view {% if request.GET.filter == "noanswer" %}selected{% endif %}"
>
{% trans "Sujets sans réponse" %}
</a>
</li>
{% if request.GET.filter %}
<li>
<a href="{% url 'topic-tag-find' tag.slug %}"
<a href="{% url "forum:topic-tag-find" tag.slug %}"
class="ico-after cross blue"
>
{% trans "Annuler le filtre" %}
Expand Down
8 changes: 4 additions & 4 deletions templates/forum/includes/feed.part.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<div class="mobile-menu-bloc mobile-all-links" data-title="Flux">
<h3>{% trans "Flux" %}</h3>
<ul>
<li><a href="{% url "post-feed-rss" %}{{param}}{{value}}" class="ico-after rss blue">{% trans "Nouveaux messages (RSS)" %}</a></li>
<li><a href="{% url "post-feed-atom" %}{{param}}{{value}}" class="ico-after rss blue">{% trans "Nouveaux messages (ATOM)" %}</a></li>
<li><a href="{% url "topic-feed-rss" %}{{param}}{{value}}" class="ico-after rss blue">{% trans "Nouveaux sujets (RSS)" %}</a></li>
<li><a href="{% url "topic-feed-atom" %}{{param}}{{value}}" class="ico-after rss blue">{% trans "Nouveaux sujets (ATOM)" %}</a></li>
<li><a href="{% url "forum:post-feed-rss" %}{{param}}{{value}}" class="ico-after rss blue">{% trans "Nouveaux messages (RSS)" %}</a></li>
<li><a href="{% url "forum:post-feed-atom" %}{{param}}{{value}}" class="ico-after rss blue">{% trans "Nouveaux messages (ATOM)" %}</a></li>
<li><a href="{% url "forum:topic-feed-rss" %}{{param}}{{value}}" class="ico-after rss blue">{% trans "Nouveaux sujets (RSS)" %}</a></li>
<li><a href="{% url "forum:topic-feed-atom" %}{{param}}{{value}}" class="ico-after rss blue">{% trans "Nouveaux sujets (ATOM)" %}</a></li>
</ul>
</div>
2 changes: 1 addition & 1 deletion templates/forum/includes/topic_item.part.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h3 class="content-title" itemprop="itemListElement">
{% for tag in topic.tags.all|slice:":3" %}
{% if tag.slug %}
<li>
<a href="{% url 'topic-tag-find' tag.slug %}" title="Tag {{ tag.title }}">
<a href="{% url "forum:topic-tag-find" tag.slug %}" title="Tag {{ tag.title }}">
{{ tag.title }}
</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion templates/forum/includes/topic_row.part.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{% for tag in topic.tags.all %}
{% if tag.slug %}
<li>
<a href="{% url 'topic-tag-find' tag.slug %}" class="topic-tag" title="Tag {{ tag.title }}">
<a href="{% url "forum:topic-tag-find" tag.slug %}" class="topic-tag" title="Tag {{ tag.title }}">
{{ tag.title }}
</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion templates/forum/includes/topic_solve_form.part.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n %}
<form action="{% url 'topic-edit' %}" method="post">
<form action="{% url "forum:topic-edit" %}" method="post">
<input type="hidden" name="topic" value="{{ topic.pk }}">
<input type="hidden" name="nb" value="{{ nb }}">
<input type="hidden" name="page" value="{{ nb }}">
Expand Down
6 changes: 3 additions & 3 deletions templates/forum/last_topics.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


{% block new_btn %}
<a href="{% url 'cats-forums-list' %}" class="new-btn ico-after view blue">
<a href="{% url "forum:cats-forums-list" %}" class="new-btn ico-after view blue">
{% trans "Tous les forums" %}
</a>
{% endblock %}
Expand All @@ -38,14 +38,14 @@
<h3>{% trans "Ordre de tri" %}</h3>
<ul>
<li>
<a href="{% url 'last-subjects' %}?order=creation"
<a href="{% url "forum:last-subjects" %}?order=creation"
class="ico-after move {% if request.GET.order == 'creation' %}selected{% endif %}"
>
{% trans "Date de création" %}
</a>
</li>
<li>
<a href="{% url 'last-subjects' %}?order=last_post"
<a href="{% url "forum:last-subjects" %}?order=last_post"
class="ico-after history {% if request.GET.order == 'last_post' %}selected{% endif %}"
>
{% trans "Date de la dernière réponse" %}
Expand Down
8 changes: 4 additions & 4 deletions templates/forum/post/new.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,27 @@
<div class="content-wrapper">
{% for message in posts %}
{% captureas edit_link %}
{% url 'post-edit' %}?message={{ message.pk }}
{% url "forum:post-edit" %}?message={{ message.pk }}
{% endcaptureas %}

{% captureas hide_link %}{{ edit_link }}{% endcaptureas %}
{% captureas show_link %}{{ edit_link }}{% endcaptureas %}
{% captureas alert_link %}{{ edit_link }}{% endcaptureas %}

{% captureas cite_link %}
{% url 'post-new' %}?sujet={{ topic.pk }}&amp;cite={{ message.pk }}
{% url "forum:post-new" %}?sujet={{ topic.pk }}&amp;cite={{ message.pk }}
{% endcaptureas %}

{% captureas helpful_link %}
{% url 'post-useful' %}?message={{ message.pk }}
{% url "forum:post-useful" %}?message={{ message.pk }}
{% endcaptureas %}

{% captureas karma_link %}
{% url 'api:forum:post-karma' message.pk %}
{% endcaptureas %}

{% captureas alerts_solve_link %}
{% url "forum-solve-alert" %}
{% url "forum:solve-alert" %}
{% endcaptureas %}

{% include "misc/message.part.html" with perms_change=perms.forum.change_topic %}
Expand Down
38 changes: 19 additions & 19 deletions templates/forum/topic/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
{% for tag in topic.tags.all %}
{% if tag.slug %}
<li>
<a href="{% url 'topic-tag-find' tag.slug %}" rel="tag">
<a href="{% url "forum:topic-tag-find" tag.slug %}" rel="tag">
{{ tag.title }}
</a>
</li>
Expand Down Expand Up @@ -87,38 +87,38 @@
{% for message in posts %}
{% captureas edit_link %}
{% if message.pk == topic.first_post.pk %}
{% url 'topic-edit' %}?topic={{ topic.pk }}
{% url "forum:topic-edit" %}?topic={{ topic.pk }}
{% else %}
{% url 'post-edit' %}?message={{ message.pk }}
{% url "forum:post-edit" %}?message={{ message.pk }}
{% endif %}
{% endcaptureas %}

{% captureas post_action_link %}
{% url 'post-edit' %}?message={{ message.pk }}
{% url "forum:post-edit" %}?message={{ message.pk }}
{% endcaptureas %}

{% captureas hide_link %}{{ post_action_link }}{% endcaptureas %}
{% captureas show_link %}{{ post_action_link }}{% endcaptureas %}
{% captureas alert_link %}{% url 'post-create-alert' %}?message={{ message.pk }}{% endcaptureas %}
{% captureas alert_link %}{% url "forum:post-create-alert" %}?message={{ message.pk }}{% endcaptureas %}

{% captureas cite_link %}
{% url 'post-new' %}?sujet={{ topic.pk }}&amp;cite={{ message.pk }}
{% url "forum:post-new" %}?sujet={{ topic.pk }}&amp;cite={{ message.pk }}
{% endcaptureas %}

{% captureas helpful_link %}
{% url 'post-useful' %}?message={{ message.pk }}
{% url "forum:post-useful" %}?message={{ message.pk }}
{% endcaptureas %}

{% captureas karma_link %}
{% url 'api:forum:post-karma' message.pk %}
{% endcaptureas %}

{% captureas alerts_solve_link %}
{% url "forum-solve-alert" %}
{% url "forum:solve-alert" %}
{% endcaptureas %}

{% captureas unread_link %}
{% url 'post-unread' %}?message={{ message.pk }}
{% url "forum:post-unread" %}?message={{ message.pk }}
{% endcaptureas %}

{% if forloop.first and page_obj.number > 1 %}
Expand Down Expand Up @@ -146,7 +146,7 @@

{# Anwser form #}
{% captureas form_action %}
{% url 'post-new' %}?sujet={{ topic.pk }}
{% url "forum:post-new" %}?sujet={{ topic.pk }}
{% endcaptureas %}

{% include "misc/message_form.html" with member=user %}
Expand All @@ -163,12 +163,12 @@

{% block new_btn %}
{% if user.profile.can_write_now %}
<a href="{% url 'topic-new' %}?forum={{ topic.forum.pk }}" class="new-btn ico-after more blue">
<a href="{% url "forum:topic-new" %}?forum={{ topic.forum.pk }}" class="new-btn ico-after more blue">
{% trans "Nouveau sujet" %}
</a>

{% if topic.author.pk == user.pk and topic.first_post.is_visible or is_staff %}
<a href="{% url 'topic-edit' %}?topic={{ topic.pk }}" class="new-btn ico-after edit blue">
<a href="{% url "forum:topic-edit" %}?topic={{ topic.pk }}" class="new-btn ico-after edit blue">
{% trans "Éditer le sujet" %}
</a>
{% endif %}
Expand All @@ -184,7 +184,7 @@
{% endif %}

<li>
{% url 'topic-edit' as link_follow_without_parameter %}
{% url "forum:topic-edit" as link_follow_without_parameter %}

{% with topic_is_followed=topic|is_followed %}
{% with topic_id=topic.pk|stringformat:"s" %}
Expand All @@ -203,7 +203,7 @@
</li>

<li>
{% url 'topic-edit' as link_follow_without_parameter %}
{% url "forum:topic-edit" as link_follow_without_parameter %}

{% with topic_is_email_followed=topic|is_email_followed %}
{% with topic_id=topic.pk|stringformat:"s" %}
Expand All @@ -222,7 +222,7 @@
</li>

<li>
{% url 'topic-edit' as link_request_without_parameter %}
{% url "forum:topic-edit" as link_request_without_parameter %}

{% with topic_id=topic.pk|stringformat:"s" %}
{% with link_request=link_request_without_parameter|add:'?topic='|add:topic_id %}
Expand Down Expand Up @@ -266,7 +266,7 @@ <h3>{% trans "Développement" %}</h3>
{% else %}
<li>
<a href="#create-issue" class="open-modal ico-after github blue">{% trans 'Créer un ticket' %}</a>
<form action="{% url 'manage-issue' topic.pk %}" method="post" id="create-issue" class="modal modal-flex">
<form action="{% url "forum:manage-issue" topic.pk %}" method="post" id="create-issue" class="modal modal-flex">
{% if has_token %}
{% csrf_token %}
<select name="repository">
Expand Down Expand Up @@ -296,7 +296,7 @@ <h3>{% trans "Développement" %}</h3>

<li>
<a href="#link-issue" class="open-modal ico-after arrow-right blue">{% trans 'Associer un ticket' %}</a>
<form action="{% url 'manage-issue' topic.pk %}" method="post" id="link-issue" class="modal modal-flex">
<form action="{% url "forum:manage-issue" topic.pk %}" method="post" id="link-issue" class="modal modal-flex">
{% csrf_token %}
<p>
{% trans "Quel est le dépôt et le numéro du ticket GitHub que vous souhaitez associer ?" %}
Expand Down Expand Up @@ -332,7 +332,7 @@ <h3>{% trans "Modération" %}</h3>
{% trans "Fermer le sujet" %}
{% endif %}
</a>
<form action="{% url 'topic-edit' %}" method="post" id="lock-open-topic-{{ topic.pk }}" class="modal modal-flex">
<form action="{% url "forum:topic-edit" %}" method="post" id="lock-open-topic-{{ topic.pk }}" class="modal modal-flex">
<input type="hidden" name="topic" value="{{ topic.pk }}">
<input type="hidden" name="nb" value="{{ nb }}">
<input type="hidden" name="page" value="{{ nb }}">
Expand All @@ -358,7 +358,7 @@ <h3>{% trans "Modération" %}</h3>
</li>

<li>
<form action="{% url 'topic-edit' %}" method="post">
<form action="{% url "forum:topic-edit" %}" method="post">
<input type="hidden" name="topic" value="{{ topic.pk }}">
<input type="hidden" name="nb" value="{{ nb }}">
<input type="hidden" name="page" value="{{ nb }}">
Expand Down
Loading

0 comments on commit 143537e

Please sign in to comment.