aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/templates
diff options
context:
space:
mode:
Diffstat (limited to 'pydis_site/templates')
-rw-r--r--pydis_site/templates/base/base.html2
-rw-r--r--pydis_site/templates/base/navbar.html45
-rw-r--r--pydis_site/templates/home/account/delete.html47
-rw-r--r--pydis_site/templates/home/account/settings.html136
-rw-r--r--pydis_site/templates/home/index.html16
-rw-r--r--pydis_site/templates/staff/logs.html9
-rw-r--r--pydis_site/templates/wiki/base.html2
-rw-r--r--pydis_site/templates/wiki/history.html2
-rw-r--r--pydis_site/templates/wiki/includes/breadcrumbs.html4
9 files changed, 244 insertions, 19 deletions
diff --git a/pydis_site/templates/base/base.html b/pydis_site/templates/base/base.html
index a9b31c0f..70426dc1 100644
--- a/pydis_site/templates/base/base.html
+++ b/pydis_site/templates/base/base.html
@@ -28,6 +28,7 @@
{# Font-awesome here is defined explicitly so that we can have Pro #}
<script src="https://kit.fontawesome.com/ae6a3152d8.js"></script>
+ <script src="{% static "js/base/modal.js" %}"></script>
<link rel="stylesheet" href="{% static "css/base/base.css" %}">
<link rel="stylesheet" href="{% static "css/base/notification.css" %}">
@@ -36,6 +37,7 @@
{% render_block "css" %}
</head>
<body class="site">
+ <!-- Git hash for this release: {{ git_sha }} -->
<main class="site-content">
{% if messages %}
diff --git a/pydis_site/templates/base/navbar.html b/pydis_site/templates/base/navbar.html
index 8cdac0de..c2915025 100644
--- a/pydis_site/templates/base/navbar.html
+++ b/pydis_site/templates/base/navbar.html
@@ -63,9 +63,9 @@
</a>
<div class="navbar-dropdown">
<a class="navbar-item" href="{% url 'wiki:get' path="resources/" %}">
- Learning Resources
+ Resources
</a>
- <a class="navbar-item" href="{% url 'wiki:get' path="tools/" %}">
+ <a class="navbar-item" href="{% url 'wiki:get' path="resources/tools/" %}">
Tools
</a>
<a class="navbar-item" href="{% url 'wiki:get' path="contributing/" %}">
@@ -84,8 +84,14 @@
Privacy
</a>
<hr class="navbar-divider">
- <a class="navbar-item" href="{% url 'wiki:get' path="code-jams/" %}">
- Code Jams
+ <div class="navbar-item">
+ <strong>Events</strong>
+ </div>
+ <a class="navbar-item" href="{% url 'wiki:get' path="code-jams/code-jam-7/" %}">
+ Most Recent: Code Jam 7
+ </a>
+ <a class="navbar-item" href="{% url 'wiki:get' path="events/" %}">
+ All events
</a>
<hr class="navbar-divider">
@@ -102,7 +108,15 @@
{% else %}
<form method="post" action="{% url 'logout' %}">
{% csrf_token %}
- <button type="submit" class="navbar-item button is-white is-inline is-fullwidth has-text-left is-size-navbar-menu has-text-grey-dark">Logout</button>
+
+ <div class="field navbar-item is-paddingless is-fullwidth is-grouped">
+ <button type="submit" class="button is-white is-inline is-fullwidth has-text-left is-size-navbar-menu has-text-grey-dark">Logout</button>
+ <a title="Settings" class="button is-white is-inline has-text-right is-size-navbar-menu has-text-grey-dark modal-button" data-target="account-modal">
+ <span class="is-icon">
+ <i class="fas fa-cog"></i>
+ </span>
+ </a>
+ </div>
</form>
{% endif %}
@@ -116,3 +130,24 @@
</a>
</div>
</nav>
+
+{% if user.is_authenticated %}
+ <script defer type="text/javascript">
+ // Script which loads and sets up the account settings modal.
+ // This script must be placed in a template, or rewritten to take the fetch
+ // URL as a function argument, in order to be used.
+
+ "use strict";
+
+ // Create and prepend a new div for this modal
+ let element = document.createElement("div");
+ document.body.prepend(element);
+
+ fetch("{% url "account_settings" %}") // Fetch the URL
+ .then((response) => response.text()) // Read in the data stream as text
+ .then((text) => {
+ element.outerHTML = text; // Replace the div's HTML with the loaded modal HTML
+ setupModal(document.getElementById("account-modal")); // Set up the modal
+ });
+ </script>
+{% endif %}
diff --git a/pydis_site/templates/home/account/delete.html b/pydis_site/templates/home/account/delete.html
new file mode 100644
index 00000000..0d44e32a
--- /dev/null
+++ b/pydis_site/templates/home/account/delete.html
@@ -0,0 +1,47 @@
+{% extends 'base/base.html' %}
+{% load static %}
+
+{% block title %}Delete Account{% endblock %}
+
+{% block content %}
+ {% include "base/navbar.html" %}
+
+ <section class="section content">
+ <div class="container">
+ <h2 class="is-size-2 has-text-centered">Account Deletion</h2>
+
+ <div class="columns is-centered">
+ <div class="column is-half-desktop is-full-tablet is-full-mobile">
+
+ <article class="message is-danger">
+ <div class="message-body">
+ <p>
+ You have requested to delete the account with username
+ <strong><span class="has-text-dark is-family-monospace">{{ user.username }}</span></strong>.
+ </p>
+
+ <p>
+ Please note that this <strong>cannot be undone</strong>.
+ </p>
+
+ <p>
+ To verify that you'd like to remove your account, please type your username into the box below.
+ </p>
+ </div>
+ </article>
+ </div>
+ </div>
+
+ <div class="columns is-centered">
+ <div class="column is-half-desktop is-full-tablet is-full-mobile">
+ <form method="post">
+ {% csrf_token %}
+ <label for="id_username" class="label requiredField">Username</label>
+ <input id="id_username" class="input" type="text" required name="username">
+ <input style="margin-top: 1em;" type="submit" value="I understand, delete my account" class="button is-primary">
+ </form>
+ </div>
+ </div>
+ </div>
+ </section>
+{% endblock %}
diff --git a/pydis_site/templates/home/account/settings.html b/pydis_site/templates/home/account/settings.html
new file mode 100644
index 00000000..ed59b052
--- /dev/null
+++ b/pydis_site/templates/home/account/settings.html
@@ -0,0 +1,136 @@
+{% load socialaccount %}
+
+{# This template is just for a modal, which is actually inserted into the navbar #}
+{# template. Take a look at `navbar.html` to see how it's inserted. #}
+
+<div class="modal" id="account-modal">
+ <div class="modal-background"></div>
+ <div class="modal-card">
+ <div class="modal-card-head">
+ <div class="modal-card-title">Settings for {{ user.username }}</div>
+
+ {% if groups %}
+ <div>
+ {% for group in groups %}
+ <span class="tag is-primary">{{ group.name }}</span>
+ {% endfor %}
+ </div>
+ {% else %}
+ <span class="tag is-dark">No groups</span>
+ {% endif %}
+ </div>
+ <div class="modal-card-body">
+ <h3 class="title">Connections</h3>
+ <div class="columns">
+ {% if discord_provider is not None %}
+ <div class="column">
+ <div class="box">
+ {% if not discord %}
+ <div class="media">
+ <div class="media-left">
+ <div class="image">
+ <i class="fab fa-discord fa-3x has-text-primary"></i>
+ </div>
+ </div>
+ <div class="media-content">
+ <div class="title is-5">Discord</div>
+ <div class="subtitle is-6">Not connected</div>
+ </div>
+ </div>
+ <div>
+ <br />
+ <a class="button is-primary" href="{% provider_login_url "discord" process="connect" %}">
+ <span class="icon">
+ <i class="fad fa-link"></i>
+ </span>
+ <span>Connect</span>
+ </a>
+ </div>
+ {% else %}
+ <div class="media">
+ <div class="media-left">
+ <div class="image">
+ <i class="fab fa-discord fa-3x has-text-primary"></i>
+ </div>
+ </div>
+ <div class="media-content">
+ <div class="title is-5">Discord</div>
+ <div class="subtitle is-6">{{ user.username }}</div>
+ </div>
+ </div>
+ <div>
+ <br />
+ <button class="button" disabled>
+ <span class="icon">
+ <i class="fas fa-check"></i>
+ </span>
+ <span>Connected</span>
+ </button>
+ </div>
+ {% endif %}
+ </div>
+ </div>
+ {% endif %}
+
+ {% if github_provider is not None %}
+ <div class="column">
+ <div class="box">
+ {% if not github %}
+ <div class="media">
+ <div class="media-left">
+ <div class="image">
+ <i class="fab fa-github fa-3x"></i>
+ </div>
+ </div>
+ <div class="media-content">
+ <div class="title is-5">GitHub</div>
+ <div class="subtitle is-6">Not connected</div>
+ </div>
+ </div>
+ <div>
+ <br />
+ <a class="button is-primary" href="{% provider_login_url "github" process="connect" %}">
+ <span class="icon">
+ <i class="fad fa-link"></i>
+ </span>
+ <span>Connect</span>
+ </a>
+ </div>
+ {% else %}
+ <div class="media">
+ <div class="media-left">
+ <div class="image">
+ <i class="fab fa-github fa-3x"></i>
+ </div>
+ </div>
+ <div class="media-content">
+ <div class="title is-5">GitHub</div>
+ <div class="subtitle is-6">{{ github.extra_data.name }}</div>
+ </div>
+ </div>
+ <div>
+ <form method="post" action="{% url "account_settings" %}" type="submit">
+ {% csrf_token %}
+
+ <input type="hidden" name="provider" value="github" />
+
+ <br />
+ <button type="submit" class="button is-danger">
+ <span class="icon">
+ <i class="fas fa-times"></i>
+ </span>
+ <span>Disconnect</span>
+ </button>
+ </form>
+ </div>
+ {% endif %}
+ </div>
+ </div>
+ {% endif %}
+ </div>
+ </div>
+ <div class="modal-card-foot">
+ <a class="button is-danger" href="{% url "account_delete" %}">Delete Account</a>
+ </div>
+ </div>
+</div>
diff --git a/pydis_site/templates/home/index.html b/pydis_site/templates/home/index.html
index 0fa2f67c..3e96cc91 100644
--- a/pydis_site/templates/home/index.html
+++ b/pydis_site/templates/home/index.html
@@ -16,7 +16,7 @@
<h1 class="is-size-1">Who are we?</h1>
<br>
<div class="columns is-desktop">
- <div class="column is-half-desktop">
+ <div class="column is-half-desktop content">
<p>
We're a large community focused around the Python programming language.
We believe anyone can learn to code, and are very dedicated to helping
@@ -37,11 +37,11 @@
</p>
</div>
- {# Intro video #}
- <div class="column is-half-desktop video-container">
- <iframe src="https://www.youtube.com/embed/DIBXg8Qh7bA" frameborder="0"
- allow="accelerometer; encrypted-media; gyroscope; picture-in-picture"
- allowfullscreen></iframe>
+ {# Right column container #}
+ <div class="column is-half-desktop">
+ <a href="https://pythondiscord.com/pages/code-jams/code-jam-7/">
+ <img src="{% static "images/events/summer_code_jam_2020.png" %}">
+ </a>
</div>
</div>
@@ -92,10 +92,12 @@
<a href="https://adafruit.com" class="column is-narrow">
<img src="{% static "images/sponsors/adafruit.png" %}" alt="Adafruit"/>
</a>
+ <a href="https://sentry.io" class="column is-narrow">
+ <img src="{% static "images/sponsors/sentry.png" %}" alt="Sentry"/>
+ </a>
</div>
</div>
</div>
</section>
{% endblock %}
-
diff --git a/pydis_site/templates/staff/logs.html b/pydis_site/templates/staff/logs.html
index 9c8ed7d3..8c92836a 100644
--- a/pydis_site/templates/staff/logs.html
+++ b/pydis_site/templates/staff/logs.html
@@ -19,10 +19,15 @@
<div class="discord-message-header">
<span class="discord-username"
style="color: {{ message.author.top_role.colour | hex_colour }}">{{ message.author }}</span><span
- class="discord-message-metadata">{{ message.timestamp }} | User ID: {{ message.author.id }}</span>
+ class="discord-message-metadata has-text-grey">{{ message.timestamp }} | User ID: {{ message.author.id }}</span>
</div>
<div class="discord-message-content">
- {{ message.content|linebreaks }}
+ {{ message.content | escape | visible_newlines | safe }}
+ </div>
+ <div class="discord-message-attachments">
+ {% for attachment in message.attachments %}
+ <img alt="Attachment" class="discord-attachment" src="{{ attachment }}">
+ {% endfor %}
</div>
{% for embed in message.embeds %}
<div class="discord-embed is-size-7">
diff --git a/pydis_site/templates/wiki/base.html b/pydis_site/templates/wiki/base.html
index 9f904324..846492ab 100644
--- a/pydis_site/templates/wiki/base.html
+++ b/pydis_site/templates/wiki/base.html
@@ -7,7 +7,7 @@
{% block head %}
{{ block.super }}
- <script src="{% static "wiki/js/jquery-3.3.1.min.js" %}" type="text/javascript"></script>
+ <script src="{% static "wiki/js/jquery-3.4.1.min.js" %}" type="text/javascript"></script>
<script src="{% static "wiki/js/core.js" %}" type="text/javascript"></script>
<script src="{% static "js/wiki/simplemde.min.js" %}" type="text/javascript"></script>
diff --git a/pydis_site/templates/wiki/history.html b/pydis_site/templates/wiki/history.html
index 3788385f..ee297bdd 100644
--- a/pydis_site/templates/wiki/history.html
+++ b/pydis_site/templates/wiki/history.html
@@ -124,5 +124,3 @@
<script src="{% static "js/wiki/modal.js" %}" type="text/javascript"></script>
<script src="{% static "js/wiki/history.js" %}" type="text/javascript"></script>
{% endblock %}
-
-
diff --git a/pydis_site/templates/wiki/includes/breadcrumbs.html b/pydis_site/templates/wiki/includes/breadcrumbs.html
index 791beb90..1b268e11 100644
--- a/pydis_site/templates/wiki/includes/breadcrumbs.html
+++ b/pydis_site/templates/wiki/includes/breadcrumbs.html
@@ -10,13 +10,13 @@
{# Continue, we don't want to show the root element #}
{% else %}
<li>
- <a href="{% url 'wiki:get' path=ancestor.path %}">{{ ancestor.article.current_revision.title|truncatechars:25 }}</a>
+ <a href="{% url 'wiki:get' path=ancestor.path %}">{{ ancestor.article.current_revision.title }}</a>
</li>
{% endif %}
{% endfor %}
<li class="is-active">
- <a href="{% url 'wiki:get' path=article.path %}">{{ article.current_revision.title|truncatechars:25 }}</a>
+ <a href="{% url 'wiki:get' path=article.path %}">{{ article.current_revision.title }}</a>
</li>
</ul>
</nav>