Skip to content

Commit 1a1d3bc

Browse files
committed
Redirects: match recent improvements
Matches readthedocs/readthedocs.org#10881. Applied the same code we have for automation rules.
1 parent 45a6d6b commit 1a1d3bc

File tree

1 file changed

+33
-11
lines changed

1 file changed

+33
-11
lines changed

readthedocsext/theme/templates/projects/partials/edit/redirect_list.html

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,34 @@
3737
{% endblock list_placeholder_text %}
3838

3939
{% block list_item_right_buttons %}
40+
{% trans "Move up" as button_up_text %}
41+
{% trans "Move down" as button_down_text %}
42+
{% if not forloop.first %}
43+
<button class="ui icon button"
44+
data-bind="click: $root.post_child_form"
45+
data-content="{{ button_up_text }}"
46+
aria-label="{{ button_up_text }}"
47+
title="{{ button_up_text }}">
48+
<form method="post" action="{% url 'projects_redirects_insert' project_slug=project.slug redirect_pk=object.pk position=object.position|add:"-1" %}">
49+
{% csrf_token %}
50+
</form>
51+
<i class="fa-solid fa-arrow-up icon"></i>
52+
</button>
53+
{% endif %}
54+
55+
{% if not forloop.last %}
56+
<button class="ui icon button"
57+
data-bind="click: $root.post_child_form"
58+
data-content="{{ button_down_text }}"
59+
aria-label="{{ button_down_text }}"
60+
title="{{ button_down_text }}">
61+
<form method="post" action="{% url 'projects_redirects_insert' project_slug=project.slug redirect_pk=object.pk position=object.position|add:"1" %}">
62+
{% csrf_token %}
63+
</form>
64+
<i class="fa-solid fa-arrow-down icon"></i>
65+
</button>
66+
{% endif %}
67+
4068
<a class="ui button"
4169
href="{% url 'projects_redirects_edit' project_slug=project.slug redirect_pk=object.pk %}"
4270
data-content="{% trans "Edit redirect" %}">
@@ -79,13 +107,10 @@
79107
<span>/</span><span class="ui violet text">$version</span>
80108
{% endif %}
81109
<span>{{ object.from_url }}</span>
82-
{% if object.redirect_type == "prefix" %}
83-
<span class="ui violet text">$1</span>
84-
{% endif %}
85110
{% else %}
86-
{% if object.redirect_type == "sphinx_html" %}
111+
{% if object.redirect_type == "clean_url_to_html" %}
87112
<span>/**/</span><span class="ui violet text">$1</span><span>/</span>
88-
{% elif object.redirect_type == "sphinx_htmldir" %}
113+
{% elif object.redirect_type == "html_to_clean_url" %}
89114
<span>/**/</span><span class="ui violet text">$1</span><span>.html</span>
90115
{% endif %}
91116
{% endif %}
@@ -95,18 +120,15 @@
95120
<label>{% trans "Redirect to:" %}</label>
96121
{% spaceless %}
97122
{% if object.from_url %}
98-
{% if object.redirect_type == "page" or object.redirect_type == "prefix" %}
123+
{% if object.redirect_type == "page" %}
99124
<span>/</span><span class="ui violet text">$lang</span>
100125
<span>/</span><span class="ui violet text">$version</span>
101-
{% if object.redirect_type == "prefix" %}
102-
<span>/</span><span class="ui violet text">$1</span>
103-
{% endif %}
104126
{% endif %}
105127
<span>{{ object.to_url }}</span>
106128
{% else %}
107-
{% if object.redirect_type == "sphinx_html" %}
129+
{% if object.redirect_type == "clean_url_to_html" %}
108130
<span>/**/</span><span class="ui violet text">$1</span><span>.html</span>
109-
{% elif object.redirect_type == "sphinx_htmldir" %}
131+
{% elif object.redirect_type == "html_to_clean_url" %}
110132
<span>/**/</span><span class="ui violet text">$1</span><span>/</span>
111133
{% endif %}
112134
{% endif %}

0 commit comments

Comments
 (0)