Hacking towards the second.py functionality
This commit is contained in:
19
magic_app/templates/app_install.html
Normal file
19
magic_app/templates/app_install.html
Normal file
@ -0,0 +1,19 @@
|
||||
{% from "macros.html" import with_errors %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html>
|
||||
<head>
|
||||
<title>Install {{ app_name | capitalize }}</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Install {{ app_name | capitalize }}</p>
|
||||
<form method="POST" action="{{ url_for("apps.install", app_name=app_name) }}">
|
||||
{% for field in form %}
|
||||
{{ field.label() }} {{ with_errors(field, style='font-weight: bold') }}
|
||||
{% endfor %}
|
||||
<input type="submit" value="Install" />
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
17
magic_app/templates/app_list.html
Normal file
17
magic_app/templates/app_list.html
Normal file
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html>
|
||||
<head>
|
||||
<title>Application Listing</title>
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
||||
{% for app in apps %}
|
||||
<li>
|
||||
<a href="{{ url_for('apps.install', app_name=app) }}">{{ app }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
27
magic_app/templates/app_status.html
Normal file
27
magic_app/templates/app_status.html
Normal file
@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html>
|
||||
<head>
|
||||
<title>{{ app_name | capitalize }} Status</title>
|
||||
<style>
|
||||
table,
|
||||
th,
|
||||
td {
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table>
|
||||
<tr>
|
||||
<th>App</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ app_name }}</th>
|
||||
<th>{{ status }}</th>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
@ -1,7 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html>
|
||||
<head></head>
|
||||
<body></body>
|
||||
</html>
|
||||
</html>
|
16
magic_app/templates/macros.html
Normal file
16
magic_app/templates/macros.html
Normal file
@ -0,0 +1,16 @@
|
||||
{#
|
||||
From: https://wtforms.readthedocs.io/en/2.3.x/specific_problems/#rendering-errors
|
||||
Usage: with_errors(form.field, style='font-weight: bold')
|
||||
#}
|
||||
|
||||
{% macro with_errors(field) %}
|
||||
<div class="form_field">
|
||||
{% if field.errors %}
|
||||
{% set css_class = 'has_error ' + kwargs.pop('class', '') %}
|
||||
{{ field(class=css_class, **kwargs) }}
|
||||
<ul class="errors">{% for error in field.errors %}<li>{{ error|e }}</li>{% endfor %}</ul>
|
||||
{% else %}
|
||||
{{ field(**kwargs) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endmacro %}
|
Reference in New Issue
Block a user