aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pysite/base_route.py12
-rw-r--r--pysite/route_manager.py7
-rw-r--r--static/favicon.icobin0 -> 28957 bytes
-rw-r--r--static/logos/logo_discord.pngbin0 -> 63590 bytes
-rw-r--r--templates/base.html17
-rw-r--r--templates/index.html19
-rw-r--r--templates/navigation.html18
7 files changed, 57 insertions, 16 deletions
diff --git a/pysite/base_route.py b/pysite/base_route.py
index 16bf0984..f983c1a2 100644
--- a/pysite/base_route.py
+++ b/pysite/base_route.py
@@ -6,14 +6,17 @@ __author__ = "Gareth Coles"
class BaseView(MethodView):
+ name = None # type: str
+
def render(self, *template_names, **context):
- # thin wrapper here in case it needs to be modified later
+ context["current_page"] = self.name
+ context["view"] = self
+
return render_template(template_names, **context)
class RouteView(BaseView):
- path = None #: str
- name = None #: str
+ path = None # type: str
@classmethod
def setup(cls: "RouteView", app: Flask):
@@ -24,8 +27,7 @@ class RouteView(BaseView):
class ErrorView(BaseView):
- name = None #: str
- error_code = None #: int
+ error_code = None # type: int
@classmethod
def setup(cls: "ErrorView", app: Flask):
diff --git a/pysite/route_manager.py b/pysite/route_manager.py
index e9e701e0..f61c4f65 100644
--- a/pysite/route_manager.py
+++ b/pysite/route_manager.py
@@ -16,10 +16,15 @@ DB_PORT = os.environ.get("RETHINKDB_PORT")
DB_DATABASE = os.environ.get("RETHINKDB_DATABASE")
DB_TABLE = os.environ.get("RETHINKDB_TABLE")
+TEMPLATES_PATH = "../templates"
+STATIC_PATH = "../static"
+
class RouteManager:
def __init__(self):
- self.app = Flask(__name__, template_folder="../templates")
+ self.app = Flask(
+ __name__, template_folder=TEMPLATES_PATH, static_folder=STATIC_PATH, static_url_path="/static"
+ )
self.app.secret_key = os.environ.get("WEBPAGE_SECRET_KEY")
self.load_views()
diff --git a/static/favicon.ico b/static/favicon.ico
new file mode 100644
index 00000000..046480bf
--- /dev/null
+++ b/static/favicon.ico
Binary files differ
diff --git a/static/logos/logo_discord.png b/static/logos/logo_discord.png
new file mode 100644
index 00000000..2bf74ffd
--- /dev/null
+++ b/static/logos/logo_discord.png
Binary files differ
diff --git a/templates/base.html b/templates/base.html
new file mode 100644
index 00000000..9e00af20
--- /dev/null
+++ b/templates/base.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ {% block head %}
+ <title>Python | {% block title %}{% endblock %}</title>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
+ <script defer src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-beta.39/js/uikit.min.js"></script>
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-beta.39/css/uikit.min.css" />
+ {% endblock %}
+</head>
+<body>
+{% include "navigation.html" %}
+{% block content %}{% endblock %}
+</body>
+</html> \ No newline at end of file
diff --git a/templates/index.html b/templates/index.html
index 07bd4541..418347d2 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -1,10 +1,9 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <title>Python | Home</title>
-</head>
-<body>
-<p>Coming soon:tm:</p>
-</body>
-</html> \ No newline at end of file
+{% extends "base.html" %}
+{% block title %}Home{% endblock %}
+{% block content %}
+ <div class="uk-container uk-section">
+ <h1 class="uk-title uk-text-center">
+ Coming soon :tm:
+ </h1>
+ </div>
+{% endblock %} \ No newline at end of file
diff --git a/templates/navigation.html b/templates/navigation.html
new file mode 100644
index 00000000..d1f1f363
--- /dev/null
+++ b/templates/navigation.html
@@ -0,0 +1,18 @@
+<div class="uk-container uk-container-expand uk-section-secondary">
+ <nav data-uk-navbar class="uk-navbar-container uk-navbar-transparent">
+ <div class="uk-navbar-left">
+ <a href="/" class="uk-navbar-item uk-logo">
+ <img src="/static/logos/logo_discord.png" style="height: 50px;"/>
+ </a>
+ </div>
+ <div class="uk-navbar-right">
+ <ul class="uk-navbar-nav">
+ {% if current_page == "index" %}
+ <li class="uk-active"><a href="/">Home</a></li>
+ {% else %}
+ <li><a href="/">Home</a></li>
+ {% endif %}
+ </ul>
+ </div>
+ </nav>
+</div> \ No newline at end of file