diff options
-rw-r--r-- | pysite/base_route.py | 3 | ||||
-rw-r--r-- | pysite/views/main/logout.py | 2 | ||||
-rw-r--r-- | templates/main/index.html | 2 | ||||
-rw-r--r-- | templates/main/info/index.html | 8 | ||||
-rw-r--r-- | templates/main/info/jams.html | 34 | ||||
-rw-r--r-- | templates/main/info/rules.html | 2 | ||||
-rw-r--r-- | templates/main/navigation.html | 36 |
7 files changed, 43 insertions, 44 deletions
diff --git a/pysite/base_route.py b/pysite/base_route.py index c7d58f49..95bf3a03 100644 --- a/pysite/base_route.py +++ b/pysite/base_route.py @@ -6,7 +6,7 @@ from flask import Blueprint, Response, jsonify, render_template, url_for from flask.views import MethodView from werkzeug.exceptions import default_exceptions -from pysite.constants import DISCORD_OAUTH_REDIRECT, ErrorCodes +from pysite.constants import ErrorCodes from pysite.mixins import OauthMixin @@ -30,7 +30,6 @@ class BaseView(MethodView, OauthMixin): context["current_page"] = self.name context["view"] = self context["logged_in"] = self.logged_in - context["login_url"] = DISCORD_OAUTH_REDIRECT context["static_file"] = self._static_file return render_template(template_names, **context) diff --git a/pysite/views/main/logout.py b/pysite/views/main/logout.py index fce30972..2461450d 100644 --- a/pysite/views/main/logout.py +++ b/pysite/views/main/logout.py @@ -4,8 +4,8 @@ from pysite.base_route import RouteView class LogoutView(RouteView): - name = "logout" path = "/auth/logout" + name = "logout" def get(self): if self.logged_in: diff --git a/templates/main/index.html b/templates/main/index.html index b4796dd4..81bab464 100644 --- a/templates/main/index.html +++ b/templates/main/index.html @@ -18,7 +18,7 @@ on a complex project, we've got someone who can help you if you get stuck. </p> <div class="uk-container uk-align-center"> - <a href="/invite" class="uk-button uk-button-large uk-button-darkish"> + <a href="{{ url_for('main.invite') }}" class="uk-button uk-button-large uk-button-darkish"> Join us on <i class="uk-icon fab fa-discord"></i> </a> </div> diff --git a/templates/main/info/index.html b/templates/main/info/index.html index f80c0f88..2d72d48f 100644 --- a/templates/main/info/index.html +++ b/templates/main/info/index.html @@ -19,28 +19,28 @@ <p> <strong>Code Jams</strong> - <a href="/info/jams"><i class="fas fa-link"></i></a> + <a href="{{ url_for('main.info.jams') }}"><i class="fas fa-link"></i></a> <br /> <span class="uk-text-meta">Information on our monthly code jams, where users are paired into teams to compete with each other</span> </p> <p> <strong>Getting Help</strong> - <a href="/info/help"><i class="fas fa-link"></i></a> + <a href="{{ url_for('main.info.help') }}"><i class="fas fa-link"></i></a> <br /> <span class="uk-text-meta">How to ask for help - and how to interpret the responses</span> </p> <p> <strong>Resources</strong> - <a href="/info/resources"><i class="fas fa-link"></i></a> + <a href="{{ url_for('main.info.resources') }}"><i class="fas fa-link"></i></a> <br /> <span class="uk-text-meta">A page full of useful resources for learning and working with Python</span> </p> <p> <strong>Server Rules</strong> - <a href="/info/rules"><i class="fas fa-link"></i></a> + <a href="{{ url_for('main.info.rules') }}"><i class="fas fa-link"></i></a> <br /> <span class="uk-text-meta">Rules and infraction information for our server</span> </p> diff --git a/templates/main/info/jams.html b/templates/main/info/jams.html index 3bba1870..f4de813c 100644 --- a/templates/main/info/jams.html +++ b/templates/main/info/jams.html @@ -91,8 +91,8 @@ dialogue, and it will be forked to your account. </p> <figure> - <img src="/static/images/jams/jams_1.png" class="uk-align-center uk-border-rounded" /> - <img src="/static/images/jams/jams_2.png" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_1.png') }}" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_2.png') }}" class="uk-align-center uk-border-rounded" /> </figure> <p> Once this has been done, you should find yourself looking at your new copy of the repository. Next @@ -101,9 +101,9 @@ collaborator. </p> <figure> - <img src="/static/images/jams/jams_3.png" class="uk-align-center uk-border-rounded" /> - <img src="/static/images/jams/jams_4.png" class="uk-align-center uk-border-rounded" /> - <img src="/static/images/jams/jams_5.png" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_3.png') }}" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_4.png') }}" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_5.png') }}" class="uk-align-center uk-border-rounded" /> </figure> <p> Now that you've set up your repository, it's time to install Git. If you're on Linux, you can @@ -119,7 +119,7 @@ repository page on GitHub. Use <code>cd project-name</code> to change directory to the repository. </p> <figure> - <img src="/static/images/jams/jams_6.png" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_6.png') }}" class="uk-align-center uk-border-rounded" /> </figure> <p> Now, open the newly-cloned repository in your favourite editor and make some edits. We'll be using @@ -127,7 +127,7 @@ you prefer. For example, let's create a file named "hello.py", and add a line of code to it. </p> <figure> - <img src="/static/images/jams/jams_7.png" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_7.png') }}" class="uk-align-center uk-border-rounded" /> </figure> <p> Now that we've edited a file, we need to make Git aware of our changes. Head back over to your @@ -140,8 +140,8 @@ Following this, we can use <code>git push origin master</code> to push our commit up to GitHub. </p> <figure> - <img src="/static/images/jams/jams_8.png" class="uk-align-center uk-border-rounded" /> - <img src="/static/images/jams/jams_9.png" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_8.png') }}" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_9.png') }}" class="uk-align-center uk-border-rounded" /> </figure> <p> In order to pull the latest version of the code when the repository was cloned earlier, we can @@ -149,9 +149,9 @@ the help of our lovely assistant... </p> <figure> - <img src="/static/images/jams/jams_10.png" class="uk-align-center uk-border-rounded" /> - <img src="/static/images/jams/jams_11.png" class="uk-align-center uk-border-rounded" /> - <img src="/static/images/jams/jams_12.png" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_10.png') }}" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_11.png') }}" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_12.png') }}" class="uk-align-center uk-border-rounded" /> </figure> <p> Oh boy. @@ -164,10 +164,10 @@ button to finish. </p> <figure> - <img src="/static/images/jams/jams_13.png" class="uk-align-center uk-border-rounded" /> - <img src="/static/images/jams/jams_14.png" class="uk-align-center uk-border-rounded" /> - <img src="/static/images/jams/jams_15.png" class="uk-align-center uk-border-rounded" /> - <img src="/static/images/jams/jams_16.png" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_13.png') }}" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_14.png') }}" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_15.png') }}" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_16.png') }}" class="uk-align-center uk-border-rounded" /> </figure> <p> Now that your pull request has been created, keep working on your project! Code that you push to @@ -177,7 +177,7 @@ if you wish. </p> <figure> - <img src="/static/images/jams/jams_17.png" class="uk-align-center uk-border-rounded" /> + <img src="{{ static_file('images/jams/jams_17.png') }}" class="uk-align-center uk-border-rounded" /> </figure> <p> That's all there is to it! Keep working at your task, do your best and you might just come out diff --git a/templates/main/info/rules.html b/templates/main/info/rules.html index dd7e14d4..e4ff0609 100644 --- a/templates/main/info/rules.html +++ b/templates/main/info/rules.html @@ -73,7 +73,7 @@ </li> <li> Keep all discussions SFW - No <a href="https://www.wikiwand.com/en/Ecchi">ecchi</a> - or <a href="https://www.wikiwand.com/en/Not_safe_for_work">NSFW media</a>. If you wouldn't want + or <a href="https://www.wikiwand.com/en/Not_safe_for_work">NSFW</a> media. If you wouldn't want the entire world to know about your interest in it, it doesn't belong on this server. </li> <li> diff --git a/templates/main/navigation.html b/templates/main/navigation.html index 53bdf196..eb325a37 100644 --- a/templates/main/navigation.html +++ b/templates/main/navigation.html @@ -6,7 +6,7 @@ <div class="uk-container uk-container-expand uk-background-secondary uk-light" uk-sticky="sel-target: .uk-navbar-container; cls-active: uk-navbar-sticky"> <nav data-uk-navbar class="uk-navbar-container uk-navbar-transparent" uk-navbar="boundary-align: true"> <div class="uk-navbar-left uk-padding-remove-left"> - <a href="/" class="uk-navbar-item uk-logo uk-padding-remove-left"> + <a href="{{ url_for('main.index') }}" class="uk-navbar-item uk-logo uk-padding-remove-left"> <img src="{{ static_file('logos/logo_banner.png') }}" class="navbar-logo"/> </a> </div> @@ -14,11 +14,11 @@ <div class="uk-navbar-right"> <ul class="uk-navbar-nav uk-visible@m"> {% if current_page == "index" %} - <li class="uk-active"><a href="/"><i class="uk-icon fas fa-home"></i> Home</a></li> + <li class="uk-active"><a href="{{ url_for('main.index') }}"><i class="uk-icon fas fa-home"></i> Home</a></li> {% else %} - <li><a href="/"><i class="uk-icon fas fa-home"></i> Home</a></li> + <li><a href="{{ url_for('main.index') }}"><i class="uk-icon fas fa-home"></i> Home</a></li> {% endif %} - <li><a href="/invite"><i class="uk-icon fab fa-discord"></i> Discord</a></li> + <li><a href="{{ url_for('main.invite') }}"><i class="uk-icon fab fa-discord"></i> Discord</a></li> </ul> <ul class="uk-navbar-nav"> <li> @@ -26,44 +26,44 @@ <div class="uk-navbar-dropdown uk-background-secondary" uk-dropdown> <ul class="uk-nav uk-navbar-dropdown-nav"> <li class="uk-nav-header uk-hidden@m">Navigation</li> - <li class="uk-nav-item uk-hidden@m"><a href="/"><i class="uk-icon fas fa-home"></i> Home</a></li> - <li class="uk-nav-item uk-hidden@m"><a href="/invite"><i class="uk-icon fab fa-discord"></i> Discord</a></li> + <li class="uk-nav-item uk-hidden@m"><a href="{{ url_for('main.index') }}"><i class="uk-icon fas fa-home"></i> Home</a></li> + <li class="uk-nav-item uk-hidden@m"><a href="{{ url_for('main.invite') }}"><i class="uk-icon fab fa-discord"></i> Discord</a></li> <li class="uk-nav-divider uk-hidden@m"></li> {% if logged_in %} - <li class="uk-active"><a href="/auth/logout"><i class="uk-icon fas fa-unlock"></i> Logout</a></li> + <li class="uk-active"><a href="{{ url_for('main.logout') }}"><i class="uk-icon fas fa-unlock"></i> Logout</a></li> {% else %} - <li class="uk-active"><a href={{ login_url }}><i class="uk-icon fas fa-lock"></i> Login with Discord</a></li> + <li class="uk-active"><a href="{{ url_for('discord.login') }}"><i class="uk-icon fas fa-lock"></i> Login with Discord</a></li> {% endif %} {% if current_page.startswith("info") %} - <li class="uk-nav-header uk-active"><a href="/info">Information</a></li> + <li class="uk-nav-header uk-active"><a href="{{ url_for('main.info.index') }}">Information</a></li> {% else %} - <li class="uk-nav-header"><a href="/info">Information</a></li> + <li class="uk-nav-header"><a href="{{ url_for('main.info.index') }}">Information</a></li> {% endif %} {% if current_page == "info/jams" %} - <li class="uk-active"><a href="/info/jams">Code Jams</a></li> + <li class="uk-active"><a href="{{ url_for('main.info.jams') }}">Code Jams</a></li> {% else %} - <li><a href="/info/jams">Code Jams</a></li> + <li><a href="{{ url_for('main.info.jams') }}">Code Jams</a></li> {% endif %} {% if current_page == "info/help" %} - <li class="uk-active"><a href="/info/help">Getting Help</a></li> + <li class="uk-active"><a href="{{ url_for('main.info.help') }}">Getting Help</a></li> {% else %} - <li><a href="/info/help">Getting Help</a></li> + <li><a href="{{ url_for('main.info.help') }}">Getting Help</a></li> {% endif %} {% if current_page == "info/resources" %} - <li class="uk-active"><a href="/info/resources">Resources</a></li> + <li class="uk-active"><a href="{{ url_for('main.info.resources') }}">Resources</a></li> {% else %} - <li><a href="/info/resources">Resources</a></li> + <li><a href="{{ url_for('main.info.resources') }}">Resources</a></li> {% endif %} {% if current_page == "info/rules" %} - <li class="uk-active"><a href="/info/rules">Server Rules</a></li> + <li class="uk-active"><a href="{{ url_for('main.info.rules') }}">Server Rules</a></li> {% else %} - <li><a href="/info/rules">Server Rules</a></li> + <li><a href="{{ url_for('main.info.rules') }}">Server Rules</a></li> {% endif %} <li class="uk-nav-divider"></li> |