diff options
author | 2019-04-10 15:19:10 +0100 | |
---|---|---|
committer | 2019-04-10 15:19:10 +0100 | |
commit | 96715aae7ced58fc80f2945e7da3d78006b3098f (patch) | |
tree | 6a4f59083221cc1c03fa4a173052b6e5d5954e26 /pydis_site/templates/base | |
parent | Pushing before work is over (diff) | |
parent | Merge pull request #203 from gdude2002/django+base-templates (diff) |
Merge branch 'django' into django+200/wiki
# Conflicts:
# pydis_site/apps/home/urls.py
Diffstat (limited to 'pydis_site/templates/base')
-rw-r--r-- | pydis_site/templates/base/base.html | 33 | ||||
-rw-r--r-- | pydis_site/templates/base/footer.html | 7 | ||||
-rw-r--r-- | pydis_site/templates/base/navbar.html | 60 |
3 files changed, 100 insertions, 0 deletions
diff --git a/pydis_site/templates/base/base.html b/pydis_site/templates/base/base.html new file mode 100644 index 00000000..5b124ded --- /dev/null +++ b/pydis_site/templates/base/base.html @@ -0,0 +1,33 @@ +{# Base template, with a few basic style definitions. #} +{% load django_simple_bulma %} +{% load static %} + +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"> + <meta name="description" + content="{% block meta-description %}We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.{% endblock %}"> + + <title>Python Discord | {% block title %}Website{% endblock %}</title> + + {% bulma %} + + {# Font-awesome here is defined explicitly so that we can have Pro #} + <link rel="stylesheet" + href="https://pro.fontawesome.com/releases/v5.7.2/css/all.css" + integrity="sha384-6jHF7Z3XI3fF4XZixAuSu0gGKrXwoX/w3uFPxC56OtjChio7wtTGJWRW53Nhx6Ev" + crossorigin="anonymous" + > + + {% block head %}{% endblock %} +</head> +<body> + +{% block content %} + {{ block.super }} +{% endblock %} + +</body> +</html> diff --git a/pydis_site/templates/base/footer.html b/pydis_site/templates/base/footer.html new file mode 100644 index 00000000..ff868160 --- /dev/null +++ b/pydis_site/templates/base/footer.html @@ -0,0 +1,7 @@ +<footer class="footer has-background-dark has-text-light"> + <div class="content has-text-centered"> + <p> + © 2019 Python Discord | Built with Django and Bulma + </p> + </div> +</footer> diff --git a/pydis_site/templates/base/navbar.html b/pydis_site/templates/base/navbar.html new file mode 100644 index 00000000..73e3917a --- /dev/null +++ b/pydis_site/templates/base/navbar.html @@ -0,0 +1,60 @@ +{% load extra_filters %} +{% load static %} + +{% comment %} +This template is responsible for rendering the main navigation on each page that uses it. +It requires two arguments to be set in the include: + +* `dropdown` (bool): True to render the dropdowns included, False to omit them +* `icon_weight` (str): Either "fas", "far" or "fal" to correspond with Font-Awesome's weight classes. + This will not affect branding icons, which have the "fab" class. +* use_logo (bool): True to render the navbar with the site logo on the left side, False to use an + icon with text instead + +For example, to use light icons and no dropdowns, you could use the following in your template: + +{% include "base/navbar.html" with icon_weight="fal" dropdowns=False %} + +This template is based on the navbar template found here: + https://github.com/gdude2002/gserv.me/blob/20f491836342925dc67b08e1bd0ea2ed29610da8/base/templates/base/navbar.html + +{% endcomment %} + +<nav class="navbar is-primary" role="navigation" aria-label="main navigation"> + <div class="container"> + <div class="navbar-brand"> + {% if use_logo %} + <a class="navbar-item" href="{% url "home.index" %}"> + <img src="{% static 'images/logo_site_banner.svg' %}" class="navbar-brand navbar-icon" alt="Python Discord"> + </a> + {% else %} + <a + {% if active_item and request.path == "/" %} + class="navbar-item is-active" + {% else %} + class="navbar-item" + {% endif %} + href="{% url "home.index" %}" + > + + <span class="icon is-size-4 is-medium"><i class="{{ icon_weight }} fa-home"></i></span> + <span class="is-hidden-touch"> Home</span> + </a> + {% endif %} + + <a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbar_menu"> + <span aria-hidden="true"></span> + <span aria-hidden="true"></span> + <span aria-hidden="true"></span> + </a> + </div> + <div class="navbar-menu is-paddingless" id="navbar_menu"> + <div class="navbar-start"> + {# Content on the left side of the navbar #} + </div> + <div class="navbar-end"> + {# Content on the right sside of the navbar #} + </div> + </div> + </div> +</nav> |