Better display for checkbox input.

pull/7/head
Ferry Boender 10 years ago
parent b84258d91b
commit 4bcd0e9e43
  1. 25
      src/scriptform.py

@ -69,6 +69,7 @@ html_header = u'''<html>
div.form li.hidden {{ display: none; }} div.form li.hidden {{ display: none; }}
div.form p.form-field-title {{ margin-bottom: 0px; }} div.form p.form-field-title {{ margin-bottom: 0px; }}
div.form p.form-field-input {{ margin-top: 0px; }} div.form p.form-field-input {{ margin-top: 0px; }}
div.form li.checkbox p.form-field-input {{ float: left; margin-right: 8px; }}
select, select,
textarea, textarea,
input[type=text], input[type=text],
@ -132,6 +133,19 @@ html_form = u'''
{footer} {footer}
''' '''
html_field = u'''
<li class="{classes}">
<p class="form-field-title">{title}</p>
<p class="form-field-input">{input} <span class="error">{errors}</span></p>
</li>
'''
html_field_checkbox = u'''
<li class="checkbox {classes}">
<p class="form-field-input">{input} <p class="form-field-title">{title}</p><span class="error">{errors}</span></p>
</li>
'''
html_submit_response = u''' html_submit_response = u'''
{header} {header}
<div class="result"> <div class="result">
@ -753,12 +767,11 @@ class ScriptFormWebApp(WebAppHandler):
if 'hidden' in field and field['hidden']: if 'hidden' in field and field['hidden']:
classes += 'hidden ' classes += 'hidden '
return (u''' if field['type'] != 'checkbox':
<li class="{classes}"> html = html_field
<p class="form-field-title">{title}</p> else:
<p class="form-field-input">{input} <span class="error">{errors}</span></p> html = html_field_checkbox
</li> return (html.format(classes=classes,
'''.format(classes=classes,
title=field['title'], title=field['title'],
input=input, input=input,
errors=u', '.join(errors))) errors=u', '.join(errors)))

Loading…
Cancel
Save