From 548101d8bbd5adff4887cfad8fc70d1a4cf82370 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Sun, 31 Jul 2011 23:55:02 +0200 Subject: Some more theming and fixes. --- budget/templates/add_bill.html | 25 +++++---------------- budget/templates/add_member.html | 4 +++- budget/templates/bill_form.html | 11 --------- budget/templates/create_project.html | 16 +++----------- budget/templates/forms.html | 43 ++++++++++++++++++++++++++++++++++++ budget/templates/home.html | 38 +++++++++---------------------- budget/templates/layout.html | 1 + budget/templates/member_form.html | 6 ----- 8 files changed, 66 insertions(+), 78 deletions(-) delete mode 100644 budget/templates/bill_form.html delete mode 100644 budget/templates/member_form.html (limited to 'budget/templates') diff --git a/budget/templates/add_bill.html b/budget/templates/add_bill.html index f959a64..d844b6a 100644 --- a/budget/templates/add_bill.html +++ b/budget/templates/add_bill.html @@ -5,26 +5,11 @@ {% endblock %} {% block content %} -

Let's add a bill

+

Add a new bill

-{% if form.errors %} -

Your form contains errors.

- -{% endif %} - -
- {{ form.hidden_tag() }} - -

{{ form.payer.label }}
{{ form.payer }}

-

{{ form.what.label }}
{{ form.what }}

-

{{ form.amount.label }}
{{ form.amount }}

-

{{ form.payed_for.label }}
{{ form.payed_for(multiple=True) }}

-

{{ form.submit }}

+
+ + {{ forms.add_bill(form) }} +
{% endblock %} diff --git a/budget/templates/add_member.html b/budget/templates/add_member.html index eabbc4f..8d24aee 100644 --- a/budget/templates/add_member.html +++ b/budget/templates/add_member.html @@ -1,4 +1,6 @@ {% extends "layout.html" %} {% block content %} -{% include "member_form.html" %} +
+ {{ forms.add_member(form) }} +
{% endblock %} diff --git a/budget/templates/bill_form.html b/budget/templates/bill_form.html deleted file mode 100644 index 61b4004..0000000 --- a/budget/templates/bill_form.html +++ /dev/null @@ -1,11 +0,0 @@ -{% import "forms.html" as forms %} -
-
- {{ form.hidden_tag() }} - {{ forms.input(form.what) }} - {{ forms.input(form.payer) }} - {{ forms.input(form.amount) }} - {{ forms.input(form.payed_for, multiple=True) }} -

{{ form.submit }}

-
-
diff --git a/budget/templates/create_project.html b/budget/templates/create_project.html index b26da2d..6593822 100644 --- a/budget/templates/create_project.html +++ b/budget/templates/create_project.html @@ -2,20 +2,10 @@ {% block content %}

Create a new project

- -{% if form.errors %} -

Your form contains errors.

- -{% endif %} - +
- {{ form.hidden_tag() }} - -

{{ form.name.label }}
{{ form.name }}

-

{{ form.id.label }}
{{ form.id }}

-

{{ form.password.label }}
{{ form.password }}

-

{{ form.contact_email.label }}
{{ form.contact_email }}

-

{{ form.submit }}

+ {{ forms.create_project(form) }}
+
{% endblock %} diff --git a/budget/templates/forms.html b/budget/templates/forms.html index 234143b..3c0e011 100644 --- a/budget/templates/forms.html +++ b/budget/templates/forms.html @@ -11,3 +11,46 @@ {% endif %} {% endmacro %} + +{% macro authenticate(form) %} + + {% include "display_errors.html" %} + {{ form.hidden_tag() }} + {{ input(form.id) }} + {{ input(form.password) }} + {{ input(form.submit) }} + +{% endmacro %} + +{% macro create_project(form) %} + + {% include "display_errors.html" %} + {{ form.hidden_tag() }} + {{ input(form.name) }} + {{ input(form.id) }} + {{ input(form.password) }} + {{ input(form.contact_email) }} + {{ input(form.submit) }} + +{% endmacro %} + +{% macro add_bill(form) %} + + {% include "display_errors.html" %} + {{ form.hidden_tag() }} + {{ input(form.what) }} + {{ input(form.payer) }} + {{ input(form.amount) }} + {{ input(form.payed_for, multiple=True) }} + {{ input(form.submit) }} + +{% endmacro %} + +{% macro add_member(form) %} + + {% include "display_errors.html" %} + {{ form.hidden_tag() }} + {{ input(form.name) }} + {{ input(form.submit) }} + +{% endmacro %} diff --git a/budget/templates/home.html b/budget/templates/home.html index ae36d4a..21de4f1 100644 --- a/budget/templates/home.html +++ b/budget/templates/home.html @@ -1,37 +1,21 @@ {% extends "layout.html" %} {% block content %} +

Welcome on the budget manager

-
-
+
+

Log to an existing project...

- - {{ auth_form.hidden_tag() }} - -

{{ auth_form.id.label }}
{{ auth_form.id }}

-

{{ auth_form.password.label }}
{{ auth_form.password }}

-

{{ auth_form.submit }}

+ {{ forms.authenticate(auth_form) }} - {% if 'projects' in session %} -

Recently visisted projects

-
    - {% for id, name in session['projects'] %} -
  • {{ name }}
  • - {% endfor %} -
- {% endif %} + {% include "recent_projects.html" %}
-
-

...or create a new one

- - {{ project_form.hidden_tag() }} - -

{{ project_form.name.label }}
{{ project_form.name }}

-

{{ project_form.id.label }}
{{ project_form.id }}

-

{{ project_form.password.label }}
{{ project_form.password }}

-

{{ project_form.contact_email.label }}
{{ project_form.contact_email }}

-

{{ project_form.submit }}

-
+
+
+

...or create a new one

+ {{ forms.create_project(project_form) }}
+ +
{% endblock %} diff --git a/budget/templates/layout.html b/budget/templates/layout.html index cd0fca4..34e7f8b 100644 --- a/budget/templates/layout.html +++ b/budget/templates/layout.html @@ -1,3 +1,4 @@ +{% import "forms.html" as forms %} diff --git a/budget/templates/member_form.html b/budget/templates/member_form.html deleted file mode 100644 index 6eb4575..0000000 --- a/budget/templates/member_form.html +++ /dev/null @@ -1,6 +0,0 @@ -{% include "display_errors.html" %} -
- {{ form.hidden_tag() }} -

{{ form.name.label }}
{{ form.name }}

-

{{ form.submit }}

-
-- cgit v1.1