This commit is contained in:
2019-01-11 19:12:03 +01:00
commit c090d65038
27 changed files with 14887 additions and 0 deletions

48
templates/base.html Normal file
View File

@@ -0,0 +1,48 @@
<!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="/static/bootstrap.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous">
<title>{% block title %}{% endblock %} - Estus Shots</title>
</head>
<body>
<div class="container">
{% set nav_bar = [
('/seasons', 'seasons', 'Seasons', 'fas fa-calendar'),
('/players', 'players', 'Players', 'fas fa-users'),
('/enemies', 'enemies', 'Enemies', 'fas fa-skull-crossbones'),
('/drinks', 'drinks', 'Drinks', 'fas fa-beer')
]-%}
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
<ul class="nav navbar-nav mr-auto">
{% for href, id, caption, icon in nav_bar %}
<li class="nav-item{% if id == active_page %} active{% endif %}">
<a class="nav-link" href="{{ href|e }}">
<i class="{{ icon|e }}"></i> {{ caption|e }}
</a>
</li>
{% endfor %}
</ul>
<ul class="nav navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="/logout">Logout</a>
</li>
</ul>
</nav>
<div>{% block content %}{% endblock %}</div>
<div>
{% block footer %}
&copy; A product of D⁵: <a href="#">Durstiger Donnerstag Digital Drinking Divison</a>.
{% endblock %}
</div>
</div>
</body>
</html>

53
templates/drinks.html Normal file
View File

@@ -0,0 +1,53 @@
{% extends "base.html" %}
{% set active_page = "drinks" %}
{% block title %}Drinks{% endblock %}
{% block content %}
{% if g.is_editor %}
<div class="btn-toolbar" role="toolbar">
<a class="btn btn-primary" href="/newdrink" role="button">New Drink</a>
</div>
{% endif %}
{% if not model.drinks %}
There are no drinks.
{% else %}
<table class="table table-hover table-striped table-bordered">
<thead>
<tr>
{% for prop, caption in model.columns %}
<th scope="col" class="col-sm-auto text-center">{{ caption }}</th>
{% endfor %}
{% if g.is_editor %}
{% for id, caption in model.controls %}
<th scope="col" class="col-sm-auto text-center">{{ caption }}</th>
{% endfor %}
{% endif %}
</tr>
</thead>
<tbody>
{% for drink in model.drinks %}
<tr>
{% for prop, caption in model.columns %}
<td class="col-sm-auto text-center">{{ drink[prop] }}</td>
{% endfor %}
{% if g.is_editor %}
{% for name, caption in model.controls %}
<td class="col-sm-auto text-center">
<a class="btn btn-dark"
href="{% if name == 'edit'%}
/drinks/{{ drink.id }}
{% endif %}">
{{ caption }}
</a>
</td>
{% endfor %}
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endblock %}

60
templates/editdrink.html Normal file
View File

@@ -0,0 +1,60 @@
{% extends "base.html" %}
{% set active_page = "drinks" %}
{% block title %}Drinks{% endblock %}
{% block content %}
<form class="needs-validation" novalidate action="/savedrink" method="post">
<div class="form-group">
<label for="id">ID</label>
<input name="id"
type="text"
class="form-control"
id="id"
value="{{ model['id'] }}"
readonly>
</div>
<div class="form-group">
<label for="name">Drink Name</label>
<input name="name"
type="text"
class="form-control"
id="name"
placeholder="Drink name..."
value="{{ model['name'] }}"
required>
</div>
<div class="form-group">
<label for="drinkVol">Alcohol %</label>
<input name="vol"
type="text"
class="form-control"
id="drinkVol"
placeholder="Drink volume..."
value="{{ model['vol'] }}"
required>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<script>
// Example starter JavaScript for disabling form submissions if there are invalid fields
(function() {
'use strict';
window.addEventListener('load', function() {
// Fetch all the forms we want to apply custom Bootstrap validation styles to
let forms = document.getElementsByClassName('needs-validation');
// Loop over them and prevent submission
let validation = Array.prototype.filter.call(forms, function (form) {
form.addEventListener('submit', function (event) {
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
}, false);
})();
</script>
{% endblock %}

79
templates/editplayer.html Normal file
View File

@@ -0,0 +1,79 @@
{% extends "base.html" %}
{% set active_page = "players" %}
{% block title %}Players{% endblock %}
{% block content %}
<form class="needs-validation" novalidate action="/saveplayer" method="post">
<div class="form-group">
<label for="playerId">ID</label>
<input name="id"
type="text"
class="form-control"
id="playerId"
value="{{ model['id'] }}"
readonly>
</div>
<div class="form-group">
<label for="newPlayerRealName">Real Name</label>
<input name="real_name"
type="text"
class="form-control"
id="newPlayerRealName"
placeholder="Enter name..."
value="{{ model['real_name'] }}">
</div>
<div class="form-group">
<label for="newPlayerAlias">Player Alias</label>
<input name="alias"
type="text"
class="form-control"
id="newPlayerAlias"
placeholder="Enter alias..."
value="{{ model['alias'] }}"
required>
</div>
<div class="form-group">
<label for="newPlayerHexID">Hex ID</label>
<input name="hex_id"
type="text"
class="form-control"
id="newPlayerHexID"
placeholder="Enter Hex ID..."
value="{{ model['hex_id'] }}">
</div>
<div class="form-group form-check">
<input name="anon"
type="checkbox"
class="form-check-input"
id="newPlayerAnon"
value="True"
{% if model['anon'] %}
checked
{% endif %}>
<label class="form-check-label" for="newPlayerAnon">Anonymize (Show only player alias)</label>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<script>
// Example starter JavaScript for disabling form submissions if there are invalid fields
(function() {
'use strict';
window.addEventListener('load', function() {
// Fetch all the forms we want to apply custom Bootstrap validation styles to
let forms = document.getElementsByClassName('needs-validation');
// Loop over them and prevent submission
let validation = Array.prototype.filter.call(forms, function (form) {
form.addEventListener('submit', function (event) {
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
}, false);
})();
</script>
{% endblock %}

53
templates/enemies.html Normal file
View File

@@ -0,0 +1,53 @@
{% extends "base.html" %}
{% set active_page = "enemies" %}
{% block title %}Enemies{% endblock %}
{% block content %}
{% if g.is_editor %}
<div class="btn-toolbar" role="toolbar">
<a class="btn btn-primary" href="/newenemy" role="button">New Enemy</a>
</div>
{% endif %}
{% if not model.enemies %}
There are no enemies.
{% else %}
<table class="table table-hover table-striped table-bordered">
<thead>
<tr>
{% for prop, caption in model.columns %}
<th scope="col" class="col-sm-auto text-center">{{ caption }}</th>
{% endfor %}
{% if g.is_editor %}
{% for id, caption in model.controls %}
<th scope="col" class="col-sm-auto text-center">{{ caption }}</th>
{% endfor %}
{% endif %}
</tr>
</thead>
<tbody>
{% for item in model.enemies %}
<tr>
{% for prop, caption in model.columns %}
<td class="col-sm-auto text-center">{{ item[prop] }}</td>
{% endfor %}
{% if g.is_editor %}
{% for name, caption in model.controls %}
<td class="col-sm-auto text-center">
<a class="btn btn-dark"
href="{% if name == 'edit'%}
/enemies/{{ item.id }}
{% endif %}">
{{ caption }}
</a>
</td>
{% endfor %}
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endblock %}

31
templates/login.html Normal file
View File

@@ -0,0 +1,31 @@
<!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="/static/bootstrap.css">
<link rel="stylesheet" href="/static/custom.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous">
<title>Login - Estus Shots</title>
</head>
<body>
<div class="container vertical-center">
<div class="card text-center mx-auto" style="width: 15rem">
<div class="card-header">Login</div>
<div class="card-body">
<form method="post">
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" class="form-control">
</div>
<button type="submit" class="btn btn-primary">Enter</button>
</form>
</div>
</div>
</div>
</body>
</html>

48
templates/players.html Normal file
View File

@@ -0,0 +1,48 @@
{% extends "base.html" %}
{% set active_page = "players" %}
{% block title %}Players{% endblock %}
{% block content %}
{% if g.is_editor %}
<div class="btn-toolbar" role="toolbar">
<a class="btn btn-primary" href="/newplayer" role="button">New Player</a>
</div>
{% endif %}
{% if not model.player_list %}
There are no players.
{% else %}
<table class="table table-hover table-striped table-bordered">
<thead>
<tr>
{% for prop, caption in model.columns %}
<th scope="col" class="col-sm-auto text-center">{{ caption }}</th>
{% endfor %}
{% if g.is_editor %}
{% for name, caption in model.controls %}
<th scope="col" class="col-sm-auto text-center">{{ caption }}</th>
{% endfor %}
{% endif %}
</tr>
</thead>
<tbody>
{% for player in model.player_list %}
<tr>
{% for prop, caption in model.columns %}
<td class="col-sm-auto text-center">{{ player[prop] }}</td>
{% endfor %}
{% if g.is_editor %}
{% for name, caption in model.controls %}
<td class="col-sm-auto text-center">
<a class="btn btn-dark" href="/players/{{ player['id'] }}">{{ caption }}</a>
</td>
{% endfor %}
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endblock %}

7
templates/seasons.html Normal file
View File

@@ -0,0 +1,7 @@
{% extends "base.html" %}
{% set active_page = "seasons" %}
{% block title %}Seasons{% endblock %}
{% block content %}
There are no seasons.
{% endblock %}