aboutsummaryrefslogtreecommitdiff
path: root/budget
diff options
context:
space:
mode:
Diffstat (limited to 'budget')
-rw-r--r--budget/forms.py6
-rw-r--r--budget/static/js/ihatemoney.js21
2 files changed, 13 insertions, 14 deletions
diff --git a/budget/forms.py b/budget/forms.py
index 4a810de..5d7c18b 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)
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;
}
}