aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/templates/wiki/includes
diff options
context:
space:
mode:
Diffstat (limited to 'pydis_site/templates/wiki/includes')
-rw-r--r--pydis_site/templates/wiki/includes/article_menu.html78
-rw-r--r--pydis_site/templates/wiki/includes/breadcrumbs.html87
-rw-r--r--pydis_site/templates/wiki/includes/editor.html4
-rw-r--r--pydis_site/templates/wiki/includes/editor_sidebar.html38
-rw-r--r--pydis_site/templates/wiki/includes/editormedia.html17
-rw-r--r--pydis_site/templates/wiki/includes/form.html16
-rw-r--r--pydis_site/templates/wiki/includes/formerrors.html15
-rw-r--r--pydis_site/templates/wiki/includes/formfield.html7
-rw-r--r--pydis_site/templates/wiki/includes/messages.html11
-rw-r--r--pydis_site/templates/wiki/includes/pagination.html27
-rw-r--r--pydis_site/templates/wiki/includes/render.html28
-rw-r--r--pydis_site/templates/wiki/includes/revision_info.html24
-rw-r--r--pydis_site/templates/wiki/includes/searchresult.html33
13 files changed, 385 insertions, 0 deletions
diff --git a/pydis_site/templates/wiki/includes/article_menu.html b/pydis_site/templates/wiki/includes/article_menu.html
new file mode 100644
index 00000000..966e8120
--- /dev/null
+++ b/pydis_site/templates/wiki/includes/article_menu.html
@@ -0,0 +1,78 @@
+{% load wiki_tags %}
+
+{% if article|can_write:user %}
+ {% with selected_tab as selected %}
+ <nav class="navbar is-light" role="navigation" aria-label="wiki navigation" id="wikiNavbar">
+ <div class="container">
+ <div class="navbar-brand">
+ {% if not user.is_anonymous %}
+ <a class="navbar-item{% if selected == "settings" %} is-active{% endif %}"
+ href="{% url 'wiki:settings' article_id=article.id path=urlpath.path %}"
+ >
+ <span class="icon">
+ <i class="fas fa-wrench"></i>
+ </span>
+
+ <span class="is-hidden-mobile">&nbsp;Settings</span>
+ </a>
+ {% endif %}
+
+ {% for plugin in article_tabs %}
+ <a class="navbar-item{% if selected == plugin.slug %} is-active{% endif %}"
+ href="{% url 'wiki:plugin' slug=plugin.slug article_id=article.id path=urlpath.path %}"
+ >
+ <span class="icon">
+ <i class="{{ plugin.article_tab.1 }}"></i>
+ </span>
+
+ <span class="is-hidden-mobile">&nbsp;{{ plugin.article_tab.0 }}</span>
+ </a>
+ {% endfor %}
+
+ <a class="navbar-item{% if selected == "history" %} is-active{% endif %}"
+ href="{% url 'wiki:history' article_id=article.id path=urlpath.path %}"
+ >
+ <span class="icon">
+ <i class="fas fa-clock"></i>
+ </span>
+
+ <span class="is-hidden-mobile">&nbsp;Changes</span>
+ </a>
+
+ {% if article|can_write:user and not article.current_revision.locked %}
+ <a class="navbar-item{% if selected == "edit" %} is-active{% endif %}"
+ href="{% url 'wiki:edit' article_id=article.id path=urlpath.path %}"
+ >
+ <span class="icon">
+ <i class="fas fa-edit"></i>
+ </span>
+
+ <span class="is-hidden-mobile">&nbsp;Edit</span>
+ </a>
+ {% else %}
+ <a class="navbar-item{% if selected == "source" %} is-active{% endif %}"
+ href="{% url 'wiki:source' article_id=article.id path=urlpath.path %}"
+ >
+ <span class="icon">
+ <i class="fas fa-book-spells"></i>
+ </span>
+
+ <span class="is-hidden-mobile">&nbsp;View Source</span>
+ </a>
+ {% endif %}
+
+ <a class="navbar-item{% if selected == "view" %} is-active{% endif %}"
+ href="{% url 'wiki:get' article_id=article.id path=urlpath.path %}"
+ >
+ <span class="icon">
+ <i class="fas fa-book-open"></i>
+ </span>
+
+ <span class="is-hidden-mobile">&nbsp;View</span>
+ </a>
+ </div>
+
+ </div>
+ </nav>
+ {% endwith %}
+{% endif %}
diff --git a/pydis_site/templates/wiki/includes/breadcrumbs.html b/pydis_site/templates/wiki/includes/breadcrumbs.html
new file mode 100644
index 00000000..a2359f39
--- /dev/null
+++ b/pydis_site/templates/wiki/includes/breadcrumbs.html
@@ -0,0 +1,87 @@
+{% if urlpath and article and not user.is_anonymous %}
+ <section class="breadcrumb-section section">
+ <div class="container">
+ <nav class="breadcrumb is-pulled-left" aria-label="breadcrumbs">
+ <ul>
+ {% for ancestor in urlpath.cached_ancestors %}
+ <li>
+ <a href="{% url 'wiki:get' path=ancestor.path %}">{{ ancestor.article.current_revision.title|truncatechars:25 }}</a>
+ </li>
+ {% endfor %}
+
+ <li class="is-active">
+ <a href="{% url 'wiki:get' path=article.path %}">{{ article.current_revision.title|truncatechars:25 }}</a>
+ </li>
+ </ul>
+ </nav>
+
+ <div class="dropdown is-pulled-right is-right">
+ <div class="dropdown-trigger">
+ <a aria-haspopup="true" aria-controls="sub-article-dropdown">
+ <span>Sub-Articles</span>
+ <span class="icon">
+ <i class="fas fa-angle-down"></i>
+ </span>
+ </a>
+ </div>
+ <div class="dropdown-menu" id="sub-article-dropdown" role="menu">
+ <div class="dropdown-content">
+ {% if children_slice %}
+ {% for child in children_slice %}
+ <a class="dropdown-item" href="{% url 'wiki:get' path=child.path %}">
+ {{ child.article.current_revision.title }}
+ </a>
+ {% endfor %}
+
+ {% if children_slice_more %}
+ <a class="dropdown-item" href="{% url 'wiki:dir' path=urlpath.path %}">
+ ...and more.
+ </a>
+ {% endif %}
+
+ <hr class="dropdown-divider">
+ {% endif %}
+
+ <a class="dropdown-item" href="{% url 'wiki:dir' path=urlpath.path %}">
+ Browse other articles
+ </a>
+ </div>
+ </div>
+ </div>
+
+ {% if request.user.is_authenticated %}
+ <div class="dropdown is-pulled-right is-right">
+ <div class="dropdown-trigger">
+ <a aria-haspopup="true" aria-controls="sub-article-dropdown">
+ <span>Create Article</span>
+ <span class="icon">
+ <i class="fas fa-angle-down"></i>
+ </span>
+ &nbsp;
+ </a>
+ </div>
+ <div class="dropdown-menu" id="sub-article-dropdown" role="menu">
+ <div class="dropdown-content">
+ {% if urlpath.parent %}
+ <a class="dropdown-item" href="{% url 'wiki:create' path=urlpath.parent.path %}">
+ <span class="icon">
+ <i class="fas fa-arrow-right"></i>
+ </span>
+ <span>At current level</span>
+ </a>
+ {% endif %}
+
+ <a class="dropdown-item" href="{% url 'wiki:create' path=urlpath.path %}">
+ <span class="icon">
+ <i class="fas fa-arrow-down"></i>
+ </span>
+ <span>Below current level</span>
+ </a>
+ </div>
+ </div>
+ </div>
+ {% endif %}
+
+ </div>
+ </section>
+{% endif %}
diff --git a/pydis_site/templates/wiki/includes/editor.html b/pydis_site/templates/wiki/includes/editor.html
new file mode 100644
index 00000000..6eb6cd45
--- /dev/null
+++ b/pydis_site/templates/wiki/includes/editor.html
@@ -0,0 +1,4 @@
+{% load wiki_tags %}
+{% include "wiki/includes/editormedia.html" %}
+
+{% wiki_form form %}
diff --git a/pydis_site/templates/wiki/includes/editor_sidebar.html b/pydis_site/templates/wiki/includes/editor_sidebar.html
new file mode 100644
index 00000000..45ac87a1
--- /dev/null
+++ b/pydis_site/templates/wiki/includes/editor_sidebar.html
@@ -0,0 +1,38 @@
+{% load static %}
+
+<section class="accordions">
+ {% for plugin, plugin_form in sidebar %}
+ <article class="accordion is-primary">
+ <div class="accordion-header toggle">
+ <p>
+ {% if plugin.sidebar.icon_class %}
+ <span class="icon">
+ {% if plugin.sidebar.icon_class == "fa-picture-o" %}
+ <i class="fas fa-images"></i>
+ {% else %}
+ <i class="fas {{ plugin.sidebar.icon_class }}"></i>
+ {% endif %}
+ </span>
+ {% endif %}
+
+ {{ plugin.sidebar.headline }}
+ </p>
+
+ </div>
+ <div class="accordion-body">
+ <div class="accordion-content">
+ {% if plugin.sidebar.template %}
+ {% with plugin_form as form %}
+ <form method="POST" class="form-horizontal sidebar-form" action="?f={{ plugin_form.form_id }}" enctype="multipart/form-data">
+ {% csrf_token %}
+ {% include plugin.sidebar.template %}
+ </form>
+ {% endwith %}
+ {% endif %}
+ </div>
+ </div>
+ </article>
+ {% endfor %}
+</section>
+
+<script type="application/javascript" src="{% static "js/wiki/editor_sidebar.js" %}"></script>
diff --git a/pydis_site/templates/wiki/includes/editormedia.html b/pydis_site/templates/wiki/includes/editormedia.html
new file mode 100644
index 00000000..c10fbef8
--- /dev/null
+++ b/pydis_site/templates/wiki/includes/editormedia.html
@@ -0,0 +1,17 @@
+{% load sekizai_tags %}
+{% load static %}
+
+{% addtoblock "js" %}
+ <script type="text/javascript" src="{% static "wiki/js/editor.js" %}"></script>
+ {% for js in editor.Media.js %}
+ <script type="text/javascript" src="{% static js %}"></script>
+ {% endfor %}
+{% endaddtoblock %}
+
+{% addtoblock "css" %}
+ {% for media, srcs in editor.Media.css.items %}
+ {% for src in srcs %}
+ <link rel="stylesheet" media="{{ media }}" href="{% static src %}" />
+ {% endfor %}
+ {% endfor %}
+{% endaddtoblock %}
diff --git a/pydis_site/templates/wiki/includes/form.html b/pydis_site/templates/wiki/includes/form.html
new file mode 100644
index 00000000..4ea08de4
--- /dev/null
+++ b/pydis_site/templates/wiki/includes/form.html
@@ -0,0 +1,16 @@
+{% load sekizai_tags %}
+{% csrf_token %}
+
+{% include "wiki/includes/formerrors.html" %}
+
+{% addtoblock "js" %}
+ {{ form.media.js }}
+{% endaddtoblock %}
+
+{% addtoblock "css" %}
+ {{ form.media.css }}
+{% endaddtoblock %}
+
+{% for field in form %}
+ {% include "wiki/includes/formfield.html" %}
+{% endfor %}
diff --git a/pydis_site/templates/wiki/includes/formerrors.html b/pydis_site/templates/wiki/includes/formerrors.html
new file mode 100644
index 00000000..c6df2637
--- /dev/null
+++ b/pydis_site/templates/wiki/includes/formerrors.html
@@ -0,0 +1,15 @@
+{% if form.non_field_errors %}
+ <article class="message is-danger">
+ {% if form_error_title %}
+ <div class="message-header">
+ <p>{{ form_error_title }}</p>
+ </div>
+ {% endif %}
+
+ <div class="message-body">
+ {% for error_message in form.non_field_errors %}
+ <p>{{ error_message }}</p>
+ {% endfor %}
+ </div>
+ </article>
+{% endif %}
diff --git a/pydis_site/templates/wiki/includes/formfield.html b/pydis_site/templates/wiki/includes/formfield.html
new file mode 100644
index 00000000..8c42cfbf
--- /dev/null
+++ b/pydis_site/templates/wiki/includes/formfield.html
@@ -0,0 +1,7 @@
+{% load wiki_extra %}
+
+{% if field.is_hidden %}
+ {{ field }}
+{% else %}
+ {% render_field field render_labels %}
+{% endif %}
diff --git a/pydis_site/templates/wiki/includes/messages.html b/pydis_site/templates/wiki/includes/messages.html
new file mode 100644
index 00000000..cdf58d87
--- /dev/null
+++ b/pydis_site/templates/wiki/includes/messages.html
@@ -0,0 +1,11 @@
+{% if messages %}
+ <!-- Messages for this instance -->
+ {% for message in messages %}
+ <article class="message {{ message.css_class }}">
+ <div class="message-body">
+ {{ message }}
+ </div>
+ </article>
+
+ {% endfor %}
+{% endif %}
diff --git a/pydis_site/templates/wiki/includes/pagination.html b/pydis_site/templates/wiki/includes/pagination.html
new file mode 100644
index 00000000..35dac538
--- /dev/null
+++ b/pydis_site/templates/wiki/includes/pagination.html
@@ -0,0 +1,27 @@
+{% load i18n %}
+
+{% if is_paginated %}
+ <nav class="pagination" role="navigation" aria-label="pagination">
+ {% if page_obj.has_previous %}
+ <a class="pagination-previous" href="?{% if search_query %}q={{ search_query }}&{% endif %}page={{ page_obj.previous_page_number }}{% if appended_key %}&{{ appended_key }}={{ appended_value }}{% endif %}">Previous</a>
+ {% else %}
+ <a class="pagination-previous tooltip" data-tooltip="This is the first page" disabled>Previous</a>
+ {% endif %}
+
+ {% if page_obj.has_next %}
+ <a class="pagination-next" href="?{% if search_query %}q={{ search_query }}&{% endif %}page={{ page_obj.next_page_number }}{% if appended_key %}&{{ appended_key }}={{ appended_value }}{% endif %}">Next</a>
+ {% else %}
+ <a class="pagination-next tooltip" data-tooltip="This is the last page" disabled>Older</a>
+ {% endif %}
+
+ <ul class="pagination-list">
+ {% for pc in paginator.page_range %}
+ {% if pc == 0 %}
+ <li><span class="pagination-ellipsis">&hellip;</span></li>
+ {% else %}
+ <li><a class="pagination-link{% if pc == page_obj.number %} is-current{% endif %}" href="?{% if search_query %}q={{ search_query }}&{% endif %}page={{ pc }}{% if appended_key %}&{{ appended_key }}={{ appended_value }}{% endif %}">{{ pc }}</a></li>
+ {% endif %}
+ {% endfor %}
+ </ul>
+ </nav>
+{% endif %}
diff --git a/pydis_site/templates/wiki/includes/render.html b/pydis_site/templates/wiki/includes/render.html
new file mode 100644
index 00000000..c0334d98
--- /dev/null
+++ b/pydis_site/templates/wiki/includes/render.html
@@ -0,0 +1,28 @@
+{% load sekizai_tags %}
+{% load static %}
+
+{% addtoblock "js" %}
+ <script type="text/javascript" src="{% static "wiki/js/article.js" %}"></script>
+{% endaddtoblock %}
+
+<div class="wiki-article">
+ {{ content|default:"" }}
+</div>
+
+{% for plugin in plugins %}
+ {% if plugin.RenderMedia.css %}
+ {% addtoblock "css" %}
+ {% for media, url in plugin.RenderMedia.css.items %}
+ <link rel="stylesheet" href="{% static url %}" />
+ {% endfor %}
+ {% endaddtoblock %}
+ {% endif %}
+
+ {% if plugin.RenderMedia.js %}
+ {% addtoblock "js" %}
+ {% for url in plugin.RenderMedia.js %}
+ <script type="text/javascript" src="{% static url %}"></script>
+ {% endfor %}
+ {% endaddtoblock %}
+ {% endif %}
+{% endfor %}
diff --git a/pydis_site/templates/wiki/includes/revision_info.html b/pydis_site/templates/wiki/includes/revision_info.html
new file mode 100644
index 00000000..f2964034
--- /dev/null
+++ b/pydis_site/templates/wiki/includes/revision_info.html
@@ -0,0 +1,24 @@
+{% comment %}
+ This reusable code is shared between different templates and different inheritors of
+ BaseRevision.
+{% endcomment %}
+
+{% load wiki_tags %}
+
+{% if not hidedate %}{{ revision.created }}{% endif %} {% if not hidenumber %}(#{{ revision.revision_number }}) by{% endif %} {% if revision.user %}{{ revision.user }}{% else %}{% if article|can_moderate:user %}{{ revision.ip_address|default:"anonymous (IP not logged)" }}{% else %}anonymous (IP logged){% endif %}{% endif %}
+
+{% if revision.deleted %}
+ <span class="tag is-danger">deleted</span>
+{% endif %}
+
+{% if revision.previous_revision.deleted and not revision.deleted %}
+ <span class="tag is-success">restored</span>
+{% endif %}
+
+{% if revision.locked %}
+ <span class="tag is-danger">locked</span>
+{% endif %}
+
+{% if revision.previous_revision.locked and not revision.locked %}
+ <span class="tag is-success">unlocked</span>
+{% endif %}
diff --git a/pydis_site/templates/wiki/includes/searchresult.html b/pydis_site/templates/wiki/includes/searchresult.html
new file mode 100644
index 00000000..897ee4a6
--- /dev/null
+++ b/pydis_site/templates/wiki/includes/searchresult.html
@@ -0,0 +1,33 @@
+{% load humanize %}
+
+<tr>
+ <td>
+ {% for urlpath in article.urlpath_set.all %}
+ <a href="{% url 'wiki:get' path=urlpath.path %}">
+ {{ article.current_revision.title }}
+ <br />
+ <small class="has-text-grey">Slug: /{{ urlpath.path }}</small>
+ </a>
+ {% empty %}
+ <a href="{% url 'wiki:get' article_id=article.id %}">
+ {{ article.current_revision.title }}
+ </a>
+ {% endfor %}
+
+ {% if article.current_revision.deleted %}
+ <span class="icon">
+ <i class="fas fa-trash"></i>
+ </span>
+ {% endif %}
+
+ {% if article.current_revision.locked %}
+ <span class="icon">
+ <i class="fas fa-lock"></i>
+ </span>
+ {% endif %}
+ </td>
+
+ <td class="has-text-right">
+ {{ article.current_revision.created|naturaltime }}
+ </td>
+</tr>