aboutsummaryrefslogtreecommitdiff
path: root/budget
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2013-01-10 15:11:56 -0800
committerAlexis Metaireau <alexis@notmyidea.org>2013-01-10 15:11:56 -0800
commit64385e0fa3139d7392f107c69267e977f72a4d46 (patch)
tree674cc80111db5b92854872c32e0a7815c1ae8871 /budget
parent800dcba2c8b26d09c19074d8604c4577d4774600 (diff)
parent8b114c5718e332553a3bb9718c707365f7ab5a0a (diff)
downloadihatemoney-mirror-64385e0fa3139d7392f107c69267e977f72a4d46.zip
ihatemoney-mirror-64385e0fa3139d7392f107c69267e977f72a4d46.tar.gz
ihatemoney-mirror-64385e0fa3139d7392f107c69267e977f72a4d46.tar.bz2
Merge pull request #97 from aavenel/cosmetics
Small changes for UI
Diffstat (limited to 'budget')
-rw-r--r--budget/forms.py12
-rw-r--r--budget/static/css/main.css4
-rw-r--r--budget/static/js/ihatemoney.js21
-rw-r--r--budget/templates/dashboard.html27
-rw-r--r--budget/templates/forms.html1
-rw-r--r--budget/web.py2
6 files changed, 36 insertions, 31 deletions
diff --git a/budget/forms.py b/budget/forms.py
index 4a810de..f243c39 100644
--- a/budget/forms.py
+++ b/budget/forms.py
@@ -19,16 +19,14 @@ def select_multi_checkbox(field, ul_class='', **kwargs):
choice_id = u'toggleField'
js_function = u'toggle();'
options = dict(kwargs, id=choice_id, onclick=js_function)
- label = _("Select All/None")
- html.append(u'<li><label for="%s">%s<span>%s</span></label></li>'
- % (choice_id, '<input %s /> ' % html_params(**options), label))
+ html.append(u'<p><a id="selectall" onclick="selectall()">%s</a> | <a id="selectnone" onclick="selectnone()">%s</a></p>'% (_("Select all"), _("Select none")))
for value, label, checked in field.iter_choices():
choice_id = u'%s-%s' % (field_id, value)
options = dict(kwargs, name=field.name, value=value, id=choice_id)
if checked:
options['checked'] = 'checked'
- html.append(u'<li><label for="%s">%s<span>%s</span></label></li>'
+ html.append(u'<p><label for="%s">%s<span>%s</span></label></p>'
% (choice_id, '<input %s /> ' % html_params(**options), label))
html.append(u'</ul>')
return u''.join(html)
@@ -189,6 +187,6 @@ class InviteForm(Form):
class CreateArchiveForm(Form):
- start_date = DateField(_("Start date"), validators=[Required(), ])
- end_date = DateField(_("End date"), validators=[Required(), ])
- name = TextField(_("Name for this archive (optional)"))
+ name = TextField(_("Name for this archive (optional)"), validators=[])
+ start_date = DateField(_("Start date"), validators=[Required()])
+ end_date = DateField(_("End date"), validators=[Required()], default=datetime.now)
diff --git a/budget/static/css/main.css b/budget/static/css/main.css
index c3c8ed9..3274241 100644
--- a/budget/static/css/main.css
+++ b/budget/static/css/main.css
@@ -189,6 +189,10 @@ tr.payer_line .balance-name{
position: absolute;
}
+.modal-body {
+ max-height:455px;
+}
+
/* Fluid Offsets for Boostrap */
.row-fluid > [class*="span"]:not([class*="offset"]):first-child{margin-left:0;}
diff --git a/budget/static/js/ihatemoney.js b/budget/static/js/ihatemoney.js
index 6a813b9..24e82b7 100644
--- a/budget/static/js/ihatemoney.js
+++ b/budget/static/js/ihatemoney.js
@@ -1,17 +1,18 @@
- // Add a script to select all or non of the checkboxes in the add_bill form
- function toggle()
+ // Add scripts to select all or non of the checkboxes in the add_bill form
+function selectall()
{
var els = document.getElementsByName('payed_for');
for(var i =0;i<els.length;i++)
{
- if(document.getElementById('toggleField').checked)
- {
- els[i].checked=true;
- }
- else
- {
- els[i].checked=false;
- }
+ els[i].checked=true;
+ }
+ }
+function selectnone()
+ {
+ var els = document.getElementsByName('payed_for');
+ for(var i =0;i<els.length;i++)
+ {
+ els[i].checked=false;
}
}
diff --git a/budget/templates/dashboard.html b/budget/templates/dashboard.html
index e9c92dd..3f50915 100644
--- a/budget/templates/dashboard.html
+++ b/budget/templates/dashboard.html
@@ -1,20 +1,21 @@
{% extends "layout.html" %}
{% block content %}
-<table id="bill_table" class="list_bills common-table zebra-striped">
+<table id="bill_table" class="table table-striped">
<thead><tr><th>{{ _("Project") }}</th><th>{{ _("Number of members") }}</th><th>{{ _("Number of bills") }}</th><th>{{_("Newest bill")}}</th><th>{{_("Oldest bill")}}</th></tr></thead>
- <tbody>{% for project in projects %}
- <tr>
-<td>{{ project.name }}</td><td>{{ project.members | count }}</td><td>{{ project.get_bills().count() }}</td>
-{% if project.has_bills() %}
-<td>{{ project.get_bills().all()[0].date }}</td>
-<td>{{ project.get_bills().all()[-1].date }}</td>
-{% else %}
-<td></td>
-<td></td>
-{% endif %}
-</tr>
- {% endfor %}</tbody>
+ <tbody>{% for project in projects|sort(attribute='name') %}
+ <tr class="{{ loop.cycle("odd", "even") }}">
+ <td>{{ project.name }}</td><td>{{ project.members | count }}</td><td>{{ project.get_bills().count() }}</td>
+ {% if project.has_bills() %}
+ <td>{{ project.get_bills().all()[0].date }}</td>
+ <td>{{ project.get_bills().all()[-1].date }}</td>
+ {% else %}
+ <td></td>
+ <td></td>
+ {% endif %}
+ </tr>
+ {% endfor %}
+ </tbody>
</table>
{% endblock %}
diff --git a/budget/templates/forms.html b/budget/templates/forms.html
index 8d15cb8..2904e0d 100644
--- a/budget/templates/forms.html
+++ b/budget/templates/forms.html
@@ -108,6 +108,7 @@
<fieldset>
<legend>{{ _("Create an archive") }}</legend>
{{ form.hidden_tag() }}
+ {{ input(form.name) }}
{{ input(form.start_date) }}
{{ input(form.end_date) }}
</fieldset>
diff --git a/budget/web.py b/budget/web.py
index 489874c..af0a933 100644
--- a/budget/web.py
+++ b/budget/web.py
@@ -389,7 +389,7 @@ def compute_bills():
return render_template("compute_bills.html")
-@main.route("/<project_id>/archives/create")
+@main.route("/<project_id>/archives/create", methods=["GET", "POST"])
def create_archive():
form = CreateArchiveForm()
if request.method == "POST":