Merge branch 'master' of ssh://git.autonomic.zone:2222/autonomic-cooperative/magic-app
This commit is contained in:
12
spikes/templates/second/deploy.html
Normal file
12
spikes/templates/second/deploy.html
Normal file
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Deployed {{ app_name }}</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>{{ app_name }} deployed as the {{ stack_name }} stack!</p>
|
||||
<p>Not sure if it actually succeeded but hey, we got here at least!</p>
|
||||
</body>
|
||||
</html>
|
11
spikes/templates/second/index.html
Normal file
11
spikes/templates/second/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Installable apps</h1>
|
||||
<p>Where the magic h<em>app</em>ens.</p>
|
||||
<ul>
|
||||
{% for app in apps %}
|
||||
<li><a href="/install/{{ app }}">{{ app }}</a></li>
|
||||
</ul>
|
||||
{% endfor %}
|
||||
{% endblock content %}
|
15
spikes/templates/second/install.html
Normal file
15
spikes/templates/second/install.html
Normal file
@ -0,0 +1,15 @@
|
||||
{% extends "base.html" %}
|
||||
{% from "second/macros.html" import with_errors %}
|
||||
|
||||
{% block title %}Install {{ app_name }} {{ super() }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<p>Install {{ app_name }}</p>
|
||||
<form method="POST" action="/deploy/{{ app_name }}">
|
||||
{% for field in form %}
|
||||
{{ field.label() }}
|
||||
{{ with_errors(field, style='font-weight: bold') }}
|
||||
{% endfor %}
|
||||
<input type="submit" value="Deploy" />
|
||||
</form>
|
||||
{% endblock content %}
|
16
spikes/templates/second/macros.html
Normal file
16
spikes/templates/second/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