Templates, Bootstrap Navbars, and Links

This commit is contained in:
2024-10-10 11:28:02 +02:00
parent ee8922e728
commit c19c6e650b
7 changed files with 104 additions and 40 deletions

Binary file not shown.

View File

@ -76,17 +76,20 @@
</style>
</head>
<body>
{% extends "base.html" %}
<div class="container">
<div>
<h1>404</h1>
<h2>Oops! Page Not Found</h2>
<img src="https://via.placeholder.com/300x300?text=Oops" alt="Error Image" class="error-image">
<p>It looks like the page you are trying to reach doesn't exist.</p>
<p>But don't worry, you can go back to the homepage by clicking the button below.</p>
<a href="/" class="home-link">Go Home</a>
</div>
</div>
{% block content %}
<div class="container">
<div>
<h1>404</h1>
<h2>Oops! Page Not Found</h2>
<img src="https://via.placeholder.com/300x300?text=Oops" alt="Error Image" class="error-image">
<p>It looks like the page you are trying to reach doesn't exist.</p>
<p>But don't worry, you can go back to the homepage by clicking the button below.</p>
<a href="/" class="home-link">Go Home</a>
</div>
</div>
{% endblock %}
</body>
</html>

View File

@ -79,15 +79,17 @@
</style>
</head>
<body>
<div class="container">
<h1>500</h1>
<h2>Internal Server Error</h2>
<img src="https://via.placeholder.com/300x300?text=Error" alt="Error Image" class="error-image">
<p>Something went wrong on our end. We're working on fixing it!</p>
<p>Please try again later, or reload the page.</p>
<a href="javascript:location.reload()" class="reload-link">Reload Page</a>
</div>
{% extends "base.html" %}
{% block content %}
<div class="container">
<h1>500</h1>
<h2>Internal Server Error</h2>
<img src="https://via.placeholder.com/300x300?text=Error" alt="Error Image" class="error-image">
<p>Something went wrong on our end. We're working on fixing it!</p>
<p>Please try again later, or reload the page.</p>
<a href="javascript:location.reload()" class="reload-link">Reload Page</a>
</div>
{% endblock %}0
</body>
</html>

28
templates/base.html Normal file
View File

@ -0,0 +1,28 @@
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<title>Hello, world!</title>
</head>
<body>
{% include "navbar.html" %}
<br/>
<div class="container">
{% block content %}
{% endblock %}
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
</body>
</html>

View File

@ -6,8 +6,12 @@
<title>Main</title>
</head>
<body>
<h1>Hello World</h1>
<p style="font-size: 5ch; color: blueviolet; font-weight: bold; font-style: italic;">This is a test</p>
{% extends "base.html" %}
{% block content %}
<h1>Hello World</h1>
<p style="font-size: 5ch; color: blueviolet; font-weight: bold; font-style: italic;">This is a test</p>
{% endblock %}
</body>
</html>

23
templates/navbar.html Normal file
View File

@ -0,0 +1,23 @@
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo01">
<a class="navbar-brand" href="{{ url_for('index') }}">Hidden brand</a>
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<li class="nav-item active">
<a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/user/Jake">Jake</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{url_for('user', name = 'John')}}">John</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>

View File

@ -6,29 +6,33 @@
<title>{{name | capitalize}}'s page</title>
</head>
<body>
<h1>Hello {{name | upper}}!!</h1> <!--This makes the whole thing capitalised-->
<h1>Hello {{name | capitalize}}!!</h1> <!--This makes the first char capitalised-->
<h1>Hello {{name | lower}}!!</h1>
<h1>Hello {{name | title}}!!</h1>
<p>{{ stuff }}</p>
<p>{{ stuff | safe }}</p> <!--This will allow html codes to be loaded-->
<p>{{ stuff | striptags }}</p> <!--This will remove html tags from the string-->
{% extends "base.html" %}
{% for item in liste %}
{% if item == 3 %}
<p>Thiiiiiiiiis is number THREEEEEEEEE!!!!</p>
{% else %}
<p style="font-size: 5ch; font-style: oblique; color: chocolate;">{{ item }}</p>
{% endif %}
{% endfor %}
{% block content %}
<h1>Hello {{name | upper}}!!</h1> <!--This makes the whole thing capitalised-->
<h1>Hello {{name | capitalize}}!!</h1> <!--This makes the first char capitalised-->
<h1>Hello {{name | lower}}!!</h1>
<h1>Hello {{name | title}}!!</h1>
<p>{{ stuff }}</p>
<p>{{ stuff | safe }}</p> <!--This will allow html codes to be loaded-->
<p>{{ stuff | striptags }}</p> <!--This will remove html tags from the string-->
<h1>Sahe thing with some math!</h1>
{% for item in liste %}
{% if item == 3 %}
<p>Thiiiiiiiiis is number THREEEEEEEEE!!!!</p>
{% else %}
<p style="font-size: 5ch; font-style: oblique; color: chocolate;">{{ item }}</p>
{% endif %}
{% endfor %}
{% for item in liste %}
<p style="font-size: 5ch; font-style: oblique; color: chocolate;">{{ item **25 }}</p>
{% endfor %}
<h1>Sahe thing with some math!</h1>
<p>The last element of my list is: {{liste[4]}}</p>
{% for item in liste %}
<p style="font-size: 5ch; font-style: oblique; color: chocolate;">{{ item **25 }}</p>
{% endfor %}
<p>The last element of my list is: {{liste[4]}}</p>
{% endblock %}
</body>
</html>