diff options
author | Marian Sigler <m@qjym.de> | 2012-09-24 03:05:54 +0200 |
---|---|---|
committer | Marian Sigler <m@qjym.de> | 2012-09-24 03:05:54 +0200 |
commit | 60ce7256e8bb38f7f7dd98b0e5540346bffcdea4 (patch) | |
tree | b4292cbfe83e151416ff5539643e872802c06ba6 /templates | |
parent | eda695239430f65ee198b7185e99619a5a080a34 (diff) | |
download | web-60ce7256e8bb38f7f7dd98b0e5540346bffcdea4.tar.gz web-60ce7256e8bb38f7f7dd98b0e5540346bffcdea4.tar.bz2 web-60ce7256e8bb38f7f7dd98b0e5540346bffcdea4.zip |
Add `logout_required; Add bootstrap for forms
Diffstat (limited to 'templates')
-rw-r--r-- | templates/_macros.html | 17 | ||||
-rw-r--r-- | templates/base.html | 6 | ||||
-rw-r--r-- | templates/index.html | 10 | ||||
-rw-r--r-- | templates/register.html | 13 | ||||
-rw-r--r-- | templates/register_complete.html | 23 | ||||
-rw-r--r-- | templates/settings.html | 15 |
6 files changed, 42 insertions, 42 deletions
diff --git a/templates/_macros.html b/templates/_macros.html index 2c933be..8298040 100644 --- a/templates/_macros.html +++ b/templates/_macros.html @@ -1,16 +1,19 @@ {% macro render_field(field) %} - <dt>{{ field.label }} - <dd>{{ field(**kwargs)|safe }} - {% if field.errors|length == 1 %} +<div class="control-group"> + {{ field.label }} + <div class="controls"> + {{ field(**kwargs)|safe }} + {%- if field.errors|length == 1 %} <div class="errors"> {{ field.errors.0 }} </div> - {% elif field.errors %} + {% elif field.errors %} <ul class="errors"> {% for error in field.errors %} <li>{{ error }}</li> {% endfor %} </ul> - {% endif %} - </dd> -{% endmacro %} + {% endif %} + </div> +</div> +{%- endmacro %} diff --git a/templates/base.html b/templates/base.html index 1886d12..c3ed80b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,4 +1,4 @@ -{%- set styles = ['layout.css'] + styles|default([]) %} +{%- set styles = ['layout.css', 'bootstrap-form.css'] + styles|default([]) %} {%- set scripts = [] + scripts|default([]) %} <!doctype html> <html> @@ -19,11 +19,13 @@ <h2>{{ title }}</h2> {% endif %} + {%- if not no_login_message %} {%- if g.user %} <p>Logged in as {{ g.user.uid }}. <a href="{{ url_for('logout') }}">Log out</a></p> {%- else %} <p>Not logged in. <a href="{{ url_for('index') }}">Log in</a></p> {%- endif %} + {%- endif %} {% with messages = get_flashed_messages(with_categories=true) %} {% if messages %} @@ -36,7 +38,5 @@ {% endwith %} {% block content %}{% endblock %} - - <pre>{{ session.__repr__() }}</pre> </body> </html> diff --git a/templates/index.html b/templates/index.html index 6147883..abcbb1d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -6,13 +6,11 @@ <p>Hallo {{ session.username }}. <a href="{{ url_for('settings') }}">Einstellungen</a></p> {%- else %} <p><a href="/register">Account erstellen</a></p> -<form action="{{ url_for('index') }}" method="post"> - <dl> - {{ render_field(form.username) }} - {{ render_field(form.password) }} - </dl> +<form action="{{ url_for('index') }}" method="post" class="form-horizontal"> + {{ render_field(form.username) }} + {{ render_field(form.password) }} {{ form.csrf_token }} - <input type="submit" value="Login" /> + <div class="form-actions"><input type="submit" value="Login" /></div> </form> {%- endif %} {%- endblock %} diff --git a/templates/register.html b/templates/register.html index e04baac..cdd101d 100644 --- a/templates/register.html +++ b/templates/register.html @@ -1,14 +1,13 @@ {%- extends 'base.html' %} {%- from '_macros.html' import render_field %} {%- set title = 'Account erstellen' %} +{%- set no_login_message = true %} {%- block content %} -<form action="{{ url_for('register') }}" method="post"> - <dl> - {{ form.errors }} - {{ render_field(form.username) }} - {{ render_field(form.mail) }} - </dl> +<form action="{{ url_for('register') }}" method="post" class="form-horizontal"> + {{ form.errors }} + {{ render_field(form.username) }} + {{ render_field(form.mail) }} {{ form.csrf_token }} - <input type="submit" value="E-Mail-Adresse bestätigen" /> + <div class="form-actions"><input type="submit" value="E-Mail-Adresse bestätigen" /></div> </form> {%- endblock %} diff --git a/templates/register_complete.html b/templates/register_complete.html index f44e43a..06d2cd9 100644 --- a/templates/register_complete.html +++ b/templates/register_complete.html @@ -1,21 +1,24 @@ {%- extends 'base.html' %} {%- from '_macros.html' import render_field %} {%- set title = 'Account erstellen' %} +{%- set no_login_message = true %} {%- block content %} -<form action="{{ url_for('register_complete', token=token) }}" method="post"> +<form action="{{ url_for('register_complete', token=token) }}" method="post" class="form-horizontal"> <p> Deine E-Mail-Adresse wurde erfolgreich bestätigt. Bitte setze nun ein Passwort, um die Registrierung abzuschließen. </p> - <dl> - <dt>Benutzername</dt> - <dd><input readonly="readonly" value="{{ username }}" /></dd> - <dt>E-Mail-Adresse</dt> - <dd><input readonly="readonly" value="{{ mail }}" /></dd> - {{ render_field(form.password) }} - {{ render_field(form.password_confirm) }} - </dl> + <div class="control-group"> + <div class="control-label">Benutzername</div> + <div class="controls"><input readonly="readonly" value="{{ username }}" /></div> + </div> + <div class="control-group"> + <div class="control-label">E-Mail-Adresse</div> + <div class="controls"><input readonly="readonly" value="{{ mail }}" /></div> + </div> + {{ render_field(form.password) }} + {{ render_field(form.password_confirm) }} {{ form.csrf_token }} - <input type="submit" value="Registrieren" /> + <div class="form-actions"><input type="submit" value="Registrieren" /></div> </form> {%- endblock %} diff --git a/templates/settings.html b/templates/settings.html index 876d2f1..13d63f4 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -2,17 +2,14 @@ {%- from '_macros.html' import render_field %} {%- set title = 'Einstellungen' %} {%- block content %} -<form action="{{ url_for('settings') }}" method="post"> +<form action="{{ url_for('settings') }}" method="post" class="form-horizontal"> <h2>Globale Einstellungen ändern</h2> - <p> - <dl> - {{ render_field(form.old_password) }} - {{ render_field(form.mail) }} - {{ render_field(form.password) }} - {{ render_field(form.password_confirm) }} - </dl> + {{ render_field(form.old_password) }} + {{ render_field(form.mail) }} + {{ render_field(form.password) }} + {{ render_field(form.password_confirm) }} {{ form.csrf_token }} - <input type="submit" value="Speichern" /> + <div class="form-actions"><input type="submit" value="Speichern" /></div> <h2>Dienste verwalten</h2> <ul> |