aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/templates/base/navbar.html
diff options
context:
space:
mode:
authorGravatar scragly <[email protected]>2019-11-11 20:22:33 +1000
committerGravatar GitHub <[email protected]>2019-11-11 20:22:33 +1000
commitcf68b3ffec8604e64dcb03d3937ae41c28bd01f6 (patch)
tree7c23f42a1d6371e4b0069564bf132538909e64e2 /pydis_site/templates/base/navbar.html
parentMerge pull request #278 from python-discord/active-infractions-validation (diff)
parentMerge branch 'master' into allauth-user-settings (diff)
Merge pull request #292 from python-discord/allauth-user-settings
Allauth improvements & GH
Diffstat (limited to 'pydis_site/templates/base/navbar.html')
-rw-r--r--pydis_site/templates/base/navbar.html31
1 files changed, 30 insertions, 1 deletions
diff --git a/pydis_site/templates/base/navbar.html b/pydis_site/templates/base/navbar.html
index 8cdac0de..2ba5bdd4 100644
--- a/pydis_site/templates/base/navbar.html
+++ b/pydis_site/templates/base/navbar.html
@@ -102,7 +102,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 +124,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 %}