Additional refactoring

This commit is contained in:
2019-02-07 20:03:58 +01:00
parent 1e15fbdd49
commit c73b374659
16 changed files with 5054 additions and 252 deletions

View File

@@ -1,24 +1,20 @@
<!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">
{% extends "bootstrap/base.html" %}
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="/static/bootstrap.css">
{% block title %}- Estus Shots{% endblock %}
<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>
{% block styles %}
{{ super() }}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
{% endblock %}
{% block navbar %}
{% 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')
]-%}
<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 %}
@@ -35,14 +31,19 @@
</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>
{% endblock %}
{% block content %}
<div class="container">
{% block page %}
{% endblock %}
<div>
{% block footer %}
&copy; Sauf Software by D⁵: <a href="#">Durstiger Donnerstag Digital Drinking Divison</a>.
{% endblock %}
</div>
</div>
{% endblock %}

View File

@@ -1,11 +1,11 @@
{% extends "base.html" %}
{% set active_page = "drinks" %}
{% block title %}Drinks{% endblock %}
{% block title %}Drinks {{ super() }}{% endblock %}
{% block content %}
{% block page %}
{% if g.is_editor %}
<div class="btn-toolbar" role="toolbar">
<a class="btn btn-primary" href="/newdrink" role="button">New Drink</a>
<a class="btn btn-primary" href="{{ url_for('new_drink') }}" role="button">New Drink</a>
</div>
{% endif %}
{% if not model.drinks %}
@@ -19,9 +19,7 @@
{% endfor %}
{% if g.is_editor %}
{% for id, caption in model.controls %}
<th scope="col" class="col-sm-auto text-center">{{ caption }}</th>
{% endfor %}
<th scope="col" class="col-sm-auto text-center"></th>
{% endif %}
</tr>
</thead>
@@ -33,16 +31,11 @@
{% 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 %}
<td class="col-sm-auto text-center">
<a class="btn btn-dark" href="{{ url_for('drink_edit', drink_id = drink.id) }}">
<span class="fas fa-pencil-alt"></span>
</a>
</td>
{% endif %}
</tr>
{% endfor %}

View File

@@ -4,7 +4,7 @@
{% block content %}
<form class="needs-validation" novalidate action="/saveseason" method="post">
<form class="needs-validation" novalidate action="/seasons/save" method="post">
<div class="form-group">
<label for="id">ID</label>
<input name="id"

View File

@@ -1,11 +1,13 @@
{% extends "base.html" %}
{% set active_page = "enemies" %}
{% block title %}Enemies{% endblock %}
{% block title %}Enemies {{ super() }}{% endblock %}
{% block content %}
{% block page %}
{% if g.is_editor %}
<div class="btn-toolbar" role="toolbar">
<a class="btn btn-primary" href="/newenemy" role="button">New Enemy</a>
<a class="btn btn-primary" href="{{ url_for('enemy_new') }}" role="button">
<span class="fas fa-plus"></span> Enemy
</a>
</div>
{% endif %}
{% if not model.enemies %}
@@ -14,35 +16,32 @@
<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 %}
<th scope="col" class="col-sm-auto text-center">ID</th>
<th scope="col" class="col-sm-auto text-center">Name</th>
<th scope="col" class="col-sm-auto text-center">Boss Enemy</th>
{% if g.is_editor %}
{% for id, caption in model.controls %}
<th scope="col" class="col-sm-auto text-center">{{ caption }}</th>
{% endfor %}
<th scope="col" class="col-sm-auto text-center">Editor</th>
{% 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 %}
<td class="col-sm-auto text-center">{{ item.id }}</td>
<td class="col-sm-auto text-center">{{ item.name }}</td>
<td class="col-sm-auto text-center">
{% if item.boss %}
<span class="fas fa-check"></span>
{% endif %}
</td>
{% 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 %}
<td class="col-sm-auto text-center">
<a class="btn btn-dark" href="{{ url_for('enemy_edit', enemy_id = item.id) }}">
<span class="fas fa-pencil-alt"></span>
</a>
</td>
{% endif %}
</tr>
{% endfor %}

View File

@@ -1,10 +1,46 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
{% extends "base.html" %}
{% set active_page = "seasons" %}
{% block title %}{{ model.season_code }} - Episodes{% endblock %}
</body>
</html>
{% block content %}
{% if g.is_editor %}
<div class="btn-toolbar" role="toolbar">
<a class="btn btn-primary" href="/newepisode" role="button">New Episode</a>
</div>
{% endif %}
{% if not model.player_list %}
There are no episodes.
{% 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 %}
<th scope="col" class="col-sm-auto text-center"></th>
{% if g.is_editor %}
<th scope="col" class="col-sm-auto text-center"></th>
{% endif %}
</tr>
</thead>
<tbody>
{% for ep in model.episodes %}
<tr>
{% for prop, _ in model.columns %}
<td class="col-sm-auto text-center">{{ ep[prop] }}</td>
{% endfor %}
<a class="btn btn-dark" href="/episodes/{{ ep['id'] }}">Show</a>
{% if g.is_editor %}
<td class="col-sm-auto text-center">
<a class="btn btn-dark" href="/editepisode/{{ ep['id'] }}">Edit</a>
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endblock %}

View File

@@ -1,10 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% set active_page = model.active_page %}
{% block title %}{{ model.page_title }} {{ super() }}{% endblock %}
</body>
</html>
{% block page %}
<div class="text-center">
<h1>{{ model.form_title }}</h1>
<form action="{{ model.post_url }}" method="post">
{{ wtf.quick_form(form, button_map={'submit_button': 'primary'}, form_type='horizontal', horizontal_columns=('lg', 2, 10)) }}
</form>
</div>
{% endblock %}

View File

@@ -1,18 +1,14 @@
<!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">
{% extends "bootstrap/base.html" %}
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="/static/bootstrap.css">
<link rel="stylesheet" href="/static/custom.css">
{% block title %}Estus Shots{% endblock %}
{% block styles %}
{{ super() }}
<link rel="stylesheet" href="/static/custom.css">
{% endblock %}
{% block content %}
<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>
@@ -27,5 +23,5 @@
</div>
</div>
</div>
</body>
</html>
{% endblock %}

View File

@@ -1,11 +1,11 @@
{% extends "base.html" %}
{% set active_page = "players" %}
{% block title %}Players{% endblock %}
{% block title %}Players {{ super() }}{% endblock %}
{% block content %}
{% block page %}
{% if g.is_editor %}
<div class="btn-toolbar" role="toolbar">
<a class="btn btn-primary" href="/newplayer" role="button">New Player</a>
<a class="btn btn-primary" href="{{ url_for('player_new') }}" role="button">New Player</a>
</div>
{% endif %}
{% if not model.player_list %}
@@ -19,9 +19,7 @@
{% endfor %}
{% if g.is_editor %}
{% for name, caption in model.controls %}
<th scope="col" class="col-sm-auto text-center">{{ caption }}</th>
{% endfor %}
<th scope="col" class="col-sm-auto text-center">Edit</th>
{% endif %}
</tr>
</thead>
@@ -33,11 +31,11 @@
{% 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 %}
<td class="col-sm-auto text-center">
<a class="btn btn-dark" href="{{ url_for('player_edit', player_id = player.id) }}">
<span class="fas fa-pencil-alt"></span>
</a>
</td>
{% endif %}
</tr>
{% endfor %}

View File

@@ -1,11 +1,11 @@
{% extends "base.html" %}
{% set active_page = "seasons" %}
{% block title %}Seasons{% endblock %}
{% block title %}Seasons {{ super() }}{% endblock %}
{% block content %}
{% block page %}
{% if g.is_editor %}
<div class="btn-toolbar" role="toolbar">
<a class="btn btn-primary" href="/newseason" role="button">New Season</a>
<a class="btn btn-primary" href="/seasons/new" role="button"><span class="fas fa-plus"></span> Season</a>
</div>
{% endif %}
{% if not model.seasons %}
@@ -18,9 +18,11 @@
<th scope="col" class="col-sm-auto text-center">{{ caption }}</th>
{% endfor %}
<th scope="col" class="col-sm-auto text-center"></th>
{# Show #}
<th scope="col" class="col-sm-auto text-center">View</th>
{% if g.is_editor %}
{# Edit #}
<th scope="col" class="col-sm-auto text-center">Editor</th>
{% endif %}
</tr>
@@ -33,12 +35,16 @@
{% endfor %}
<td class="col-sm-auto text-center">
<a class="btn btn-dark" href="/seasons/{{ item.id }}">Show</a>
<a class="btn btn-dark" href="/seasons/{{ item.id }}"><span class="fas fa-eye"></span></a>
</td>
{% if g.is_editor %}
<td class="col-sm-auto text-center">
<a class="btn btn-dark" href="/seasons/edit/{{ item.id }}">Edit</a>
<a class="btn btn-dark" href="/seasons/{{ item.id }}/edit"><span class="fas fa-pencil-alt"></span></a>
<a class="btn btn-dark" href="/seasons/{{ item.id }}/new">
<span class="fas fa-plus"></span> Episode
</a>
</td>
{% endif %}
</tr>