aboutsummaryrefslogtreecommitdiff
path: root/budget/templates
diff options
context:
space:
mode:
Diffstat (limited to 'budget/templates')
-rw-r--r--budget/templates/add_bill.html25
-rw-r--r--budget/templates/add_member.html4
-rw-r--r--budget/templates/bill_form.html11
-rw-r--r--budget/templates/create_project.html16
-rw-r--r--budget/templates/forms.html43
-rw-r--r--budget/templates/home.html38
-rw-r--r--budget/templates/layout.html1
-rw-r--r--budget/templates/member_form.html6
8 files changed, 66 insertions, 78 deletions
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 %}
-<h2>Let's add a bill</h2>
+<h2>Add a new bill</h2>
-{% if form.errors %}
- <p class=error><strong>Your form contains errors.</strong></p>
- <ul>
- {% for field, errors in form.errors.items() %}
- {% for error in errors %}
- <li>{{ field }} : {{ error }}</li>
- {% endfor %}
- {% endfor %}
- </ul>
-{% endif %}
-
- <form action="{{ url_for('add_bill', project_id=project.id) }}" method=post class="container span-24 add-bill">
- {{ form.hidden_tag() }}
-
- <p>{{ form.payer.label }}<br /> {{ form.payer }}</p>
- <p>{{ form.what.label }}<br /> {{ form.what }}</p>
- <p>{{ form.amount.label }}<br />{{ form.amount }}</p>
- <p>{{ form.payed_for.label }}<br /> {{ form.payed_for(multiple=True) }}</p>
- <p>{{ form.submit }}</p>
+<div class="container span-24 add-bill uniForm" style="width: 400px">
+ <form action="{{ url_for('add_bill', project_id=project.id) }}" method="post" class=uniForm">
+ {{ forms.add_bill(form) }}
</form>
+</div>
{% 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" %}
+ <form action="{{ url_for("add_member", project_id=project.id) }}" method="post">
+ {{ forms.add_member(form) }}
+ </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 %}
-<div class="uniForm">
-<form action="{{ url_for('add_bill', project_id=project.id) }}" method="post" class=uniForm">
- {{ form.hidden_tag() }}
- {{ forms.input(form.what) }}
- {{ forms.input(form.payer) }}
- {{ forms.input(form.amount) }}
- {{ forms.input(form.payed_for, multiple=True) }}
- <p>{{ form.submit }}</p>
-</form>
-</div>
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 %}
<h2>Create a new project</h2>
-
-{% if form.errors %}
- <p class=error><strong>Your form contains errors.</strong></p>
- <ul>{% for error in form.errors %}<li>{{ error }}</li>{% endfor %}</ul>
-{% endif %}
-
+<div class="uniForm">
<form method="post" class="container span-24 add-bill">
- {{ form.hidden_tag() }}
-
- <p>{{ form.name.label }}<br /> {{ form.name }}</p>
- <p>{{ form.id.label }}<br /> {{ form.id }}</p>
- <p>{{ form.password.label }}<br /> {{ form.password }}</p>
- <p>{{ form.contact_email.label }}<br /> {{ form.contact_email }}</p>
- <p>{{ form.submit }}</p>
+ {{ forms.create_project(form) }}
</form>
+</div>
{% 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 %}
</div>
{% 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 %}
+
<h2>Welcome on the budget manager</h2>
-<div class="span-12 prepend-2">
- <form action="{{ url_for('authenticate') }}" method="post" accept-charset="utf-8">
+<div class="span-12 prepend-2 uniForm" >
+ <form action="{{ url_for('authenticate') }}" method="post" style="width: 300px">
<h3>Log to an existing project...</h3>
-
- {{ auth_form.hidden_tag() }}
-
- <p>{{ auth_form.id.label }}<br /> {{ auth_form.id }}</p>
- <p>{{ auth_form.password.label }}<br /> {{ auth_form.password }}</p>
- <p>{{ auth_form.submit }}</p>
+ {{ forms.authenticate(auth_form) }}
</form>
- {% if 'projects' in session %}
- <h3>Recently visisted projects</h3>
- <ul>
- {% for id, name in session['projects'] %}
- <li><a href="{{ url_for("list_bills", project_id=id) }}">{{ name }}</a></li>
- {% endfor %}
- </ul>
- {% endif %}
+ {% include "recent_projects.html" %}
</div>
-<form class="span-10 last" action="{{ url_for('create_project') }}" method="post" class="container span-24 add-bill">
- <h3>...or create a new one</h3>
-
- {{ project_form.hidden_tag() }}
-
- <p>{{ project_form.name.label }}<br /> {{ project_form.name }}</p>
- <p>{{ project_form.id.label }}<br /> {{ project_form.id }}</p>
- <p>{{ project_form.password.label }}<br /> {{ project_form.password }}</p>
- <p>{{ project_form.contact_email.label }}<br /> {{ project_form.contact_email }}</p>
- <p>{{ project_form.submit }}</p>
-</form>
+<div class="span-10 last uniForm" >
+ <form action="{{ url_for('create_project') }}" method="post" style="width: 300px">
+ <h3>...or create a new one</h3>
+ {{ forms.create_project(project_form) }}</div>
+ </form>
+</div>
{% 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 %}
<!DOCTYPE html>
<html>
<head>
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 action="{{ url_for("add_member", project_id=project.id) }}" method="post">
- {{ form.hidden_tag() }}
- <p>{{ form.name.label }}<br /> {{ form.name }}</p>
- <p>{{ form.submit }}</p>
-</form>