Add Bootstrap simple template and error handling

This commit is contained in:
2020-01-09 05:20:50 +01:00
parent 15ac576058
commit 667bed6edf
13 changed files with 138 additions and 57 deletions

View File

@@ -1,30 +1,49 @@
<html>
<head>
{% if title %}
<title>{{ title }} - IGDB</title>
{% else %}
<title>Welcome to IGDB</title>
{% endif %}
</head>
<body>
<div>IGDB:
<a href="{{ url_for('index') }}">Home</a>
{% if current_user.is_anonymous %}
<a href="{{ url_for('login') }}">Login</a>
{% else %}
<a href="{{ url_for('admin') }}">Administration</a>
<a href="{{ url_for('logout') }}">Logout</a>
{% endif %}
</div>
<hr>
{% extends 'bootstrap/base.html' %}
{% block title %}
IGDB
{% endblock %}
{% block navbar %}
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{{ url_for('index') }}">Microblog</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="{{ url_for('index') }}">Home</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
{% if current_user.is_anonymous %}
<li><a href="{{ url_for('login') }}">Login</a></li>
{% else %}
<li><a href="{{ url_for('admin') }}">Administration</a></li>
<li><a href="{{ url_for('logout') }}">Logout</a></li>
{% endif %}
</ul>
</div>
</div>
</nav>
{% endblock %}
{% block content %}
<div class="container">
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul>
{% for message in messages %}
<li>{{ message }}</li>
<div class="alert alert-info" role="alert">{{ message }}</div>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
{% block content %}{% endblock %} </body>
</html>
{# application content needs to be provided in the app_content block #}
{% block app_content %}{% endblock %}
</div>
{% endblock %}