From 7992729e29a18f67c6b3324a64a8fc4e58f5acb8 Mon Sep 17 00:00:00 2001
From: Gareth Coles
Date: Sun, 14 Apr 2019 15:04:28 +0100
Subject: Remove attachments plugin, add plugin templates
---
pydis_site/settings.py | 5 +-
.../templates/wiki/plugins/images/index.html | 110 ++++++++++++
.../templates/wiki/plugins/images/purge.html | 33 ++++
.../templates/wiki/plugins/images/render.html | 22 +++
.../wiki/plugins/images/revision_add.html | 33 ++++
.../templates/wiki/plugins/images/sidebar.html | 188 +++++++++++++++++++++
.../templates/wiki/plugins/links/sidebar.html | 44 +++++
.../wiki/plugins/macros/article_list.html | 14 ++
.../templates/wiki/plugins/macros/sidebar.html | 20 +++
.../wiki/plugins/notifications/menubaritem.html | 25 +++
.../wiki/plugins/notifications/settings.html | 44 +++++
.../wiki/plugins/templatetags/article_list.html | 20 +++
12 files changed, 556 insertions(+), 2 deletions(-)
create mode 100644 pydis_site/templates/wiki/plugins/images/index.html
create mode 100644 pydis_site/templates/wiki/plugins/images/purge.html
create mode 100644 pydis_site/templates/wiki/plugins/images/render.html
create mode 100644 pydis_site/templates/wiki/plugins/images/revision_add.html
create mode 100644 pydis_site/templates/wiki/plugins/images/sidebar.html
create mode 100644 pydis_site/templates/wiki/plugins/links/sidebar.html
create mode 100644 pydis_site/templates/wiki/plugins/macros/article_list.html
create mode 100644 pydis_site/templates/wiki/plugins/macros/sidebar.html
create mode 100644 pydis_site/templates/wiki/plugins/notifications/menubaritem.html
create mode 100644 pydis_site/templates/wiki/plugins/notifications/settings.html
create mode 100644 pydis_site/templates/wiki/plugins/templatetags/article_list.html
(limited to 'pydis_site')
diff --git a/pydis_site/settings.py b/pydis_site/settings.py
index 46d49f44..f7cca777 100644
--- a/pydis_site/settings.py
+++ b/pydis_site/settings.py
@@ -87,9 +87,10 @@ INSTALLED_APPS = [
'sorl.thumbnail',
'wiki.apps.WikiConfig',
- 'wiki.plugins.attachments.apps.AttachmentsConfig',
- 'wiki.plugins.notifications.apps.NotificationsConfig',
+
'wiki.plugins.images.apps.ImagesConfig',
+ 'wiki.plugins.links.apps.LinksConfig',
+ 'wiki.plugins.redlinks.apps.RedlinksConfig',
'wiki.plugins.macros.apps.MacrosConfig',
]
diff --git a/pydis_site/templates/wiki/plugins/images/index.html b/pydis_site/templates/wiki/plugins/images/index.html
new file mode 100644
index 00000000..191d5533
--- /dev/null
+++ b/pydis_site/templates/wiki/plugins/images/index.html
@@ -0,0 +1,110 @@
+{% extends "wiki/article.html" %}
+{% load wiki_tags i18n humanize wiki_thumbnails %}
+
+
+{% block wiki_pagetitle %}{% trans "Images" %}: {{ article.current_revision.title }}{% endblock %}
+
+{% block wiki_contents_tab %}
+ {% trans "The following images are available for this article. Copy the markdown tag to directly refer to an image from the article text." %}
+
+
+
+ {% trans "Back to edit page" %}
+
+
+
+ {% for image in images %}
+ {% with image.current_revision.imagerevision as revision %}
+
+ {{ revision.get_filename|default:_("No file") }}
+ {% trans "Markdown tag" %}
+ {% trans "Uploaded by" %}
+ {% trans "Size" %}
+
+
+
+
+ {% thumbnail revision.image "250x250" as thumb %}
+
+ {% endthumbnail %}
+
+ {% if image|can_write:user %}
+
+ {% if revision.deleted %}
+
+
+ {% trans "Upload and publish new image" %}
+
+
+
+ {% trans "Restore image" %}
+
+ {% else %}
+
+
+ {% trans "Upload replacement" %}
+
+
+
+ {% trans "Remove image" %}
+
+ {% endif %}
+ {% if article|can_moderate:user %}
+
+
+
+ {% trans "Completely delete" %}
+
+ {% endif %}
+
+ {% endif %}
+
+ [image:{{ image.id }}]
+
+ {% include "wiki/includes/revision_info.html" %}
+
+ {{ revision.get_size|filesizeformat }} {{ revision.width }}x{{ revision.height }} pixels
+
+
+
+ {% trans "History" %}
+
+
+
+
+ {% for old_revision in image.revision_set.all %}
+
+
+ {% thumbnail old_revision.imagerevision.image "50x50" crop="center" as thumb %}
+
+ {% endthumbnail %}
+
+ {% include "wiki/includes/revision_info.html" with current_revision=image.current_revision revision=old_revision %}
+ {{ old_revision.imagerevision.get_size|filesizeformat }}
+ {{ old_revision.imagerevision.width }}x{{ old_revision.imagerevision.height }}
+
+ {% if image|can_write:user and old_revision != image.current_revision %}
+
+
+ {% trans "Revert to this version" %}
+
+ {% endif %}
+
+
+ {% endfor %}
+
+
+
+ {% endwith %}
+ {% empty %}
+
+
+ {% trans "There are no images for this article." %}
+
+ {% endfor %}
+
+
+
+ {% include "wiki/includes/pagination.html" %}
+
+{% endblock %}
diff --git a/pydis_site/templates/wiki/plugins/images/purge.html b/pydis_site/templates/wiki/plugins/images/purge.html
new file mode 100644
index 00000000..28b8b476
--- /dev/null
+++ b/pydis_site/templates/wiki/plugins/images/purge.html
@@ -0,0 +1,33 @@
+{% extends "wiki/article.html" %}
+{% load wiki_tags i18n humanize wiki_thumbnails %}
+
+
+{% block wiki_pagetitle %}{% trans "Purge deletion" %}: {{ image }}{% endblock %}
+
+{% block wiki_contents_tab %}
+ {% thumbnail image.current_revision.imagerevision.image "250x250" as thumb %}
+
+
+
+ {% endthumbnail %}
+
+ {% trans "Purge image: Completely remove image file and all revisions." %}
+
+
+
+{% endblock %}
diff --git a/pydis_site/templates/wiki/plugins/images/render.html b/pydis_site/templates/wiki/plugins/images/render.html
new file mode 100644
index 00000000..d4470d98
--- /dev/null
+++ b/pydis_site/templates/wiki/plugins/images/render.html
@@ -0,0 +1,22 @@
+{% load wiki_thumbnails i18n %}{% comment %}
+ This template is used for the markdown extension that renders images and captions.
+
+ NB! Watch out for line breaks, markdown might add s and s.
+{% endcomment %}{% with image.current_revision.imagerevision as revision %}{% spaceless %}
+
+
+{% if size %}
+ {% thumbnail revision.image size upscale=False as thumb %}
+
+ {% empty %}
+
+ {% trans "Image not found" %}
+
+ {% endthumbnail %}
+{% else %}
+
+{% endif %}
+
+ {{ caption|safe }}
+
+{% endspaceless %}{% endwith %}
diff --git a/pydis_site/templates/wiki/plugins/images/revision_add.html b/pydis_site/templates/wiki/plugins/images/revision_add.html
new file mode 100644
index 00000000..87ca7a08
--- /dev/null
+++ b/pydis_site/templates/wiki/plugins/images/revision_add.html
@@ -0,0 +1,33 @@
+{% extends "wiki/article.html" %}
+{% load wiki_tags i18n humanize wiki_thumbnails %}
+
+
+{% block wiki_pagetitle %}{% trans "Replace image" %}: {{ image }}{% endblock %}
+
+{% block wiki_contents_tab %}
+ {% thumbnail image.current_revision.imagerevision.image "250x250" as thumb %}
+
+
+
+ {% endthumbnail %}
+
+ {% trans "Choose an image file to replace current image." %}
+
+
+
+{% endblock %}
diff --git a/pydis_site/templates/wiki/plugins/images/sidebar.html b/pydis_site/templates/wiki/plugins/images/sidebar.html
new file mode 100644
index 00000000..909bf6c9
--- /dev/null
+++ b/pydis_site/templates/wiki/plugins/images/sidebar.html
@@ -0,0 +1,188 @@
+{% load i18n wiki_tags wiki_images_tags humanize wiki_thumbnails sekizai_tags %}
+
+
+{% addtoblock "js" %}
+
+{% endaddtoblock %}
+
+{% with article|images_for_article as images %}
+
+
+
+ {% for image in images %}
+ {% with image.current_revision.imagerevision as revision %}
+ {% thumbnail revision.image "50x50" crop="center" as thumb %}
+
+
+ {% trans "Image id" %}: {{ image.id }}
+
+ {% trans "Insert" %}
+ {% if image|can_write:user %}
+ {% trans "Replace" %}
+ {% endif %}
+
+
+
+
+
+
+
+
+ {% endthumbnail %}
+ {% endwith %}
+ {% empty %}
+
+ {% trans "No images found for this article" %}
+
+ {% endfor %}
+
+
+
+
+
+ {% trans "Manage images" %} »
+
+
+
+
+{% trans "Add new image" %}
+
+{% if article|images_can_add:user %}
+ {% if form.non_field_errors %}
+ {% if form_error_title %}{{ form_error_title }} {% endif %}
+ {% for error_message in form.non_field_errors %}
+
+ {{ error_message }}
+
+ {% endfor %}
+ {% endif %}
+
+ {# Include the hidden fields #}
+ {% for hidden in form.hidden_fields %}
+ {{ hidden }}
+ {% endfor %}
+
+
+ {% for field in form.visible_fields %}
+
+ {% if field.label %}
+
+ {% endif %}
+ {{ field }}
+ {% if field.errors %}
+
+ {% for error in field.errors %}
+
{{ error }}
+ {% endfor %}
+
+ {% endif %}
+
+ {% if field.help_text %}
+ {{ field.help_text|safe }}
+ {% endif %}
+ {% endfor %}
+
+
+
+
+
+ {% trans "Add image" %}
+
+
+{% else %}
+
+ {% if user.is_anonymous %}
+ {% include "wiki/includes/anonymous_blocked.html" %}
+ {% else %}
+ {% trans "You do not have permissions to add images." %}
+ {% endif %}
+{% endif %}
+
+
+
+
+ {% trans "How to use images" %}
+
+
+{% trans "After uploading an image, it is attached to this particular article and can be used only here. Other users may replace the image, but older versions are kept. To show the image press the Insert button and select the options you want to use. You can use Markdown in the caption. The Markdown code syntax for images looks like this" %}
+
[image:id align:right size:orig]
+ caption indented by 4 spaces
+{% trans "Possible values for align are" %} left | right
+{% trans "Possible values for size are" %} small | medium | large | orig | default
+
+{% endwith %}
+
+
diff --git a/pydis_site/templates/wiki/plugins/links/sidebar.html b/pydis_site/templates/wiki/plugins/links/sidebar.html
new file mode 100644
index 00000000..45096edd
--- /dev/null
+++ b/pydis_site/templates/wiki/plugins/links/sidebar.html
@@ -0,0 +1,44 @@
+{% load i18n sekizai_tags static %}
+
+{% trans "Link to another wiki page" %}
+
+
+ {% trans "Type in something from another wiki page's title and auto-complete will help you create a tag for your wiki link. Tags for links look like this:" %}
+
+
+[Title of link](wiki:ArticleSlug)
+
+
+
+
+
+ {% trans "Insert" %}
+
+
+
+
+
+
+{% trans "An external link" %}
+
+
+ {% trans "You can link to another website simply by inserting an address example.com or http://example.com or by using the markdown syntax:" %}
+
+[Clickable text](http://example.com)
+
+{% addtoblock "js" %}{% endaddtoblock %}
+{% addtoblock "js" %}
+
+{% endaddtoblock %}
diff --git a/pydis_site/templates/wiki/plugins/macros/article_list.html b/pydis_site/templates/wiki/plugins/macros/article_list.html
new file mode 100644
index 00000000..c9261f1e
--- /dev/null
+++ b/pydis_site/templates/wiki/plugins/macros/article_list.html
@@ -0,0 +1,14 @@
+{% load i18n wiki_macro_tags %}
+
+{% if article_children %}
+
+
+
+ {% for child in article_children %}
+ {% article_list child depth %}
+ {% empty %}
+ {% trans "Nothing below this level" %}
+ {% endfor %}
+
+
+{% endif %}
diff --git a/pydis_site/templates/wiki/plugins/macros/sidebar.html b/pydis_site/templates/wiki/plugins/macros/sidebar.html
new file mode 100644
index 00000000..31b68520
--- /dev/null
+++ b/pydis_site/templates/wiki/plugins/macros/sidebar.html
@@ -0,0 +1,20 @@
+{% load i18n wiki_macro_tags %}
+{% allowed_macros as macros %}
+
+{% for macro in macros %}
+{{ macro.short_description }}
+{{ macro.help_text|safe|linebreaks }}
+{% if macro.example_code %}
+{{ macro.example_code }}
+{% endif %}
+{% if macro.args %}
+
+{% for arg,description in macro.args.items %}
+
+ {{ arg }}
+ {{ description }}
+
+{% endfor %}
+
+{% endif %}
+{% endfor %}
diff --git a/pydis_site/templates/wiki/plugins/notifications/menubaritem.html b/pydis_site/templates/wiki/plugins/notifications/menubaritem.html
new file mode 100644
index 00000000..6f1b6000
--- /dev/null
+++ b/pydis_site/templates/wiki/plugins/notifications/menubaritem.html
@@ -0,0 +1,25 @@
+{% load i18n sekizai_tags static %}
+
+
+ {% trans "No notifications" %}
+
+
+
+
+ {% trans "Clear notifications list" %}
+
+
+
+
+
+ {% trans "Notification settings" %}
+
+
+{% addtoblock "js" %}
+
+{% endaddtoblock %}
+{% addtoblock "js" %}{% endaddtoblock %}
diff --git a/pydis_site/templates/wiki/plugins/notifications/settings.html b/pydis_site/templates/wiki/plugins/notifications/settings.html
new file mode 100644
index 00000000..51b0245e
--- /dev/null
+++ b/pydis_site/templates/wiki/plugins/notifications/settings.html
@@ -0,0 +1,44 @@
+{% extends "wiki/base.html" %}
+{% load wiki_tags i18n humanize %}
+
+
+{% block wiki_pagetitle %}{% trans "Notifications" %}: {{ article.current_revision.title }}{% endblock %}
+
+{% block wiki_contents %}
+
+{% trans "Your notification settings" %}
+
+ {% trans "Manage how often you receive notifications" %}
+
+
+
+
+
+
+{% endblock %}
diff --git a/pydis_site/templates/wiki/plugins/templatetags/article_list.html b/pydis_site/templates/wiki/plugins/templatetags/article_list.html
new file mode 100644
index 00000000..842ac3cb
--- /dev/null
+++ b/pydis_site/templates/wiki/plugins/templatetags/article_list.html
@@ -0,0 +1,20 @@
+{% load wiki_macro_tags %}
+
+
+
+
+ {{ parent.article.current_revision.title }}
+ {% if not parent.article.other_read %} {% endif %}
+
+{% if parent.article.other_read %}
+ {% with parent.children.active.default_order as children %}
+ {% if parent.level < depth and children.count %}
+
+ {% for child in children %}
+ {% article_list child depth %}
+ {% endfor %}
+
+ {% endif %}
+ {% endwith %}
+{% endif %}
+
--
cgit v1.2.3