1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ihatemoney_ynh.git synced 2024-09-03 19:26:15 +02:00

Cosmetic changes for "add a bill" panel

This commit is contained in:
A.Avenel 2012-11-20 23:33:32 +01:00
parent 0fcc2c72ec
commit bbd4a1a838
2 changed files with 13 additions and 14 deletions

View file

@ -19,16 +19,14 @@ def select_multi_checkbox(field, ul_class='', **kwargs):
choice_id = u'toggleField' choice_id = u'toggleField'
js_function = u'toggle();' js_function = u'toggle();'
options = dict(kwargs, id=choice_id, onclick=js_function) options = dict(kwargs, id=choice_id, onclick=js_function)
label = _("Select All/None") html.append(u'<p><a id="selectall" onclick="selectall()">%s</a> | <a id="selectnone" onclick="selectnone()">%s</a></p>'% (_("Select all"), _("Select none")))
html.append(u'<li><label for="%s">%s<span>%s</span></label></li>'
% (choice_id, '<input %s /> ' % html_params(**options), label))
for value, label, checked in field.iter_choices(): for value, label, checked in field.iter_choices():
choice_id = u'%s-%s' % (field_id, value) choice_id = u'%s-%s' % (field_id, value)
options = dict(kwargs, name=field.name, value=value, id=choice_id) options = dict(kwargs, name=field.name, value=value, id=choice_id)
if checked: if checked:
options['checked'] = '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)) % (choice_id, '<input %s /> ' % html_params(**options), label))
html.append(u'</ul>') html.append(u'</ul>')
return u''.join(html) return u''.join(html)

View file

@ -1,17 +1,18 @@
// Add a script to select all or non of the checkboxes in the add_bill form // Add scripts to select all or non of the checkboxes in the add_bill form
function toggle() function selectall()
{ {
var els = document.getElementsByName('payed_for'); var els = document.getElementsByName('payed_for');
for(var i =0;i<els.length;i++) for(var i =0;i<els.length;i++)
{ {
if(document.getElementById('toggleField').checked) els[i].checked=true;
{ }
els[i].checked=true; }
} function selectnone()
else {
{ var els = document.getElementsByName('payed_for');
els[i].checked=false; for(var i =0;i<els.length;i++)
} {
els[i].checked=false;
} }
} }