From 9dd3a0b3d87a0fe3162a403b891aab1e26dfffe1 Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Thu, 18 Apr 2019 17:35:58 +0100 Subject: Delete/Error/Move/Permission Denied pages --- pydis_site/apps/home/templatetags/wiki_extra.py | 7 +- pydis_site/templates/wiki/delete.html | 109 ++++++++++++++--------- pydis_site/templates/wiki/error.html | 71 ++++++++------- pydis_site/templates/wiki/move.html | 82 +++++++++-------- pydis_site/templates/wiki/permission_denied.html | 54 +++++------ 5 files changed, 190 insertions(+), 133 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/home/templatetags/wiki_extra.py b/pydis_site/apps/home/templatetags/wiki_extra.py index e0a27973..63d9bade 100644 --- a/pydis_site/apps/home/templatetags/wiki_extra.py +++ b/pydis_site/apps/home/templatetags/wiki_extra.py @@ -1,3 +1,5 @@ +from typing import Union + from django import template from django.forms import ( BooleanField, BoundField, CharField, ChoiceField, ComboField, DateField, DateTimeField, DecimalField, DurationField, @@ -97,5 +99,8 @@ def get_field_options(context, field: BoundField): @register.filter -def render_urlpath(value: URLPath): +def render_urlpath(value: Union[URLPath, str]): + if isinstance(value, str): + return value or "/" + return value.path or "/" diff --git a/pydis_site/templates/wiki/delete.html b/pydis_site/templates/wiki/delete.html index afb4140d..1be82fa9 100644 --- a/pydis_site/templates/wiki/delete.html +++ b/pydis_site/templates/wiki/delete.html @@ -1,67 +1,96 @@ {% extends "wiki/base.html" %} -{% load wiki_tags i18n sekizai_tags %} +{% load wiki_tags sekizai_tags %} -{% block wiki_pagetitle %}{% trans "Delete article" %}{% endblock %} +{% block wiki_pagetitle %}Delete Article{% endblock %} {% block wiki_contents %} -

{% trans "Delete" %} "{{ article.current_revision.title }}"

+

Delete "{{ article.current_revision.title }}"

{% if cannot_delete_root %} -

{% trans "You cannot delete a root article." %}

-

{% trans "Go back" %}

+
+
+

+ You cannot delete the root article. +

+ + + + + + Go back + +
+
{% else %} - {% if cannot_delete_children %} - -

{% trans "You cannot delete this article because you do not have permission to delete articles with children. Try to remove the children manually one-by-one." %}

- +
+
+

+ You do not have permission to delete articles that have children. +

+ + + + + + Go back + +
+
{% endif %} {% if delete_children %} +
+
+

+ You are deleting an article with children. If you delete this article, then its children will also be deleted. +

+

+ If you choose to purge this article, note that its children will also be purged. +

+
+
-

{% trans "You are deleting an article. This means that its children will be deleted as well. If you choose to purge, children will also be purged!" %}

- -

{% trans "Articles that will be deleted" %}

+

Child articles

{% endif %} {% if not cannot_delete_children %} -

{% trans "You are deleting an article. Please confirm." %}

- -
- {% wiki_form delete_form %} -
-
-
- - - {% trans "Go back" %} - - -
-
-
+

Please confirm that you would like to delete this article.

+ +
+ {% wiki_form delete_form %} + + + + + + Go back + + +
{% endif %} - {% endif %} -{% addtoblock "js" %} - -{% endaddtoblock %} - + {% addtoblock "js" %} + + {% endaddtoblock %} {% endblock %} diff --git a/pydis_site/templates/wiki/error.html b/pydis_site/templates/wiki/error.html index b54c8cff..04e6948a 100644 --- a/pydis_site/templates/wiki/error.html +++ b/pydis_site/templates/wiki/error.html @@ -9,37 +9,44 @@ {% endblock %} {% block wiki_contents %} - -{% if error_type == "ancestors_missing" %} - -

{% trans "Not found" %}

- -
-

{% trans "This article was not found, and neither was its parent article." %}

-

- {% trans "Start page" %} -

-
- -{% else %} - -

{% trans "Error" %}

- -
- {% if not error_msg %} -

{% trans "There was some sort of error accessing this page. Sorry!" %}

- {% else %} -

{{ error_msg }}

- {% endif %} -
- - {% if article %} -

- {% trans "Back to" %} {{ article.current_revision.title }} -

+ {% if error_type == "ancestors_missing" %} +

Not Found

+ +
+
+

+ We were unable to find that page. If you think this was in error, please let us know! +

+ + + + + Back to homepage + +
+
+ {% else %} +

Error

+ +
+
+

+ {% if not error_msg %} + Unfortunately, an error occurred while retrieving that page. Please let us know! + {% else %} + {{ error_msg }} + {% endif %} +

+ + {% if article %} + + + + + Back to {{ article.current_revision.title }} + + {% endif %} +
+
{% endif %} - - -{% endif %} - {% endblock %} diff --git a/pydis_site/templates/wiki/move.html b/pydis_site/templates/wiki/move.html index d93a3675..f2c83485 100644 --- a/pydis_site/templates/wiki/move.html +++ b/pydis_site/templates/wiki/move.html @@ -5,46 +5,58 @@ {% block wiki_contents_tab %} -
-
-
- {% wiki_form form %} - -
- - - - - -
-

+

+
+ {% if urlpath.get_descendants %} {% blocktrans count cnt=urlpath.get_descendants.count trimmed %} - {{ cnt }} nested article will also be moved.
- Be careful, links to this article and {{ cnt }} article nested - in this hierarchy will not be updated. +

+ Please note that this article has {{ cnt }} child article. If you + decide to move this article, then links to any child articles will + not be updated. +

{% plural %} - {{ cnt }} nested articles will also be moved.
- Be careful, links to this article and {{ cnt }} articles nested - in this hierarchy will not be updated. +

+ Please note that this article has {{ cnt }} child articles. If you + decide to move this article, then links to any child articles will + not be updated. +

{% endblocktrans %} + {% endif %} +

+ Remember: Any links to this article will not be automatically updated. You + may leave behind a redirect page by specifying that option below, but these + are temporary - so it's better to update the links directly.

-
-
- - - {% trans "Go back" %} - - -
-
- +
-
+ +
+ {% wiki_form form %} + + {# Not gonna lie, I have no idea what this is or what it's for #} +
+ + + + + +
+ + + + + + Go back + + +
{% addtoblock "js" %} diff --git a/pydis_site/templates/wiki/permission_denied.html b/pydis_site/templates/wiki/permission_denied.html index 06afbbda..3314a79d 100644 --- a/pydis_site/templates/wiki/permission_denied.html +++ b/pydis_site/templates/wiki/permission_denied.html @@ -1,32 +1,36 @@ {% extends "wiki/base.html" %} -{% load wiki_tags i18n %} - +{% load wiki_tags %} {% block wiki_pagetitle %}Permission Denied{% endblock %} {% block wiki_contents %} -

{% trans "Permission Denied" %}

-

- - {% trans "Sorry, you don't have permission to access this page." %} -

- {% if article.current_revision.locked %} -

- - {% trans "This article is locked for editing." %} -

- {% endif %} - -

- {% if not read_denied %} - - {% trans "Back to article" %} - - {% elif urlpath.parent %} - - {% trans "Back to article" %} - - {% endif %} -

+
+
+

Permission Denied

+
+
+

+ Sorry, you don't have permission to access this page. +

+ {% if article.current_revision.locked %} +

This article is locked for editing.

+ {% endif %} + {% if not read_denied %} + + + + + Back to article + + {% elif urlpath.parent %} + + + + + Back to article + + {% endif %} +
+
{% endblock %} -- cgit v1.2.3