diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2011-06-11 17:50:19 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2011-06-11 17:50:19 +0200 |
commit | b280d60368ed6a287d309063ccf9b61a09dc971f (patch) | |
tree | 61223d0f02455513c772f3f7ac6a6d37b3a1db46 | |
parent | f0e7c6253eb80ae81ed0f7ec6a1b5fe01e5c5e14 (diff) | |
download | Ishtar-b280d60368ed6a287d309063ccf9b61a09dc971f.tar.bz2 Ishtar-b280d60368ed6a287d309063ccf9b61a09dc971f.zip |
Highlight mandatory fields (closes #435)
-rw-r--r-- | ishtar/templates/default_wizard.html | 12 | ||||
-rw-r--r-- | ishtar/templates/window.html | 9 | ||||
-rw-r--r-- | static/media/style.css | 16 |
3 files changed, 30 insertions, 7 deletions
diff --git a/ishtar/templates/default_wizard.html b/ishtar/templates/default_wizard.html index c2a42dad5..33eac942c 100644 --- a/ishtar/templates/default_wizard.html +++ b/ishtar/templates/default_wizard.html @@ -19,13 +19,21 @@ {%if form.non_form_errors%}<tr class='error'><th colspan='2'>{{form.non_form_errors}}</th></tr>{%endif%} {{ form.management_form }} {% for formsetform in form.forms %} - {{ formsetform.as_table }} + {% for field in formsetform %} + <tr{% if field.field.required %} class='required'{% endif %}> + <th><label for="{{ field.label }}">{{ field.label_tag }}</th> + <td> {{ field.errors }}{{field|safe}}</td> + </tr>{% endfor %} {% endfor %} <tr class='modify'><td colspan="2"><button name="formset_modify" value="{{form_step}}">{% trans "Add/Modify" %}</button></td></tr></li> </table> {% else %} <table> - {{ form.as_table }} + {% for field in form %} + <tr{% if field.field.required %} class='required'{% endif %}> + <th><label for="{{ field.label }}">{{ field.label_tag }}</th> + <td> {{ field.errors }}{{field|safe}}</td> + </tr>{% endfor %} </table> {% endif %} <input type="hidden" name="{{ step_field }}" value="{{ step0 }}" /> diff --git a/ishtar/templates/window.html b/ishtar/templates/window.html index 3c52a3d90..a92f859ab 100644 --- a/ishtar/templates/window.html +++ b/ishtar/templates/window.html @@ -27,12 +27,17 @@ save_and_close_window("{{parent_name}}", "{{parent_pk}}", "{{new_item_label}}", {% endif %} <div id="window_content"> <h3>{{title}}</h3> - <form action="." method="post">{% csrf_token %} + <form action="." method="post" class='form'>{% csrf_token %} <table> - {{form.as_table}} + {% for field in form %} + <tr{% if field.field.required %} class='required'{% endif %}> + <th><label for="{{ field.label }}">{{ field.label_tag }}</th> + <td> {{ field.errors }}{{field|safe}}</td> + </tr>{% endfor %} <tr><td colspan='2' class='submit_button'><input type="submit" id="submit_new_item" value="{% trans "Add" %}"/></td></tr> </table> </form> + </div> </div> </body> diff --git a/static/media/style.css b/static/media/style.css index 0ded7a460..a177cbd07 100644 --- a/static/media/style.css +++ b/static/media/style.css @@ -187,21 +187,31 @@ div.form { text-align:center; } -div.form table{ +.form table{ padding:0.2em; margin-left:auto; margin-right:auto; } -div.form table th{ +.form table th{ text-align:left; width:200px; + font-weight:normal; } -div.form .errorlist{ +.form .errorlist{ color:#922; } +.form table .required th{ + font-weight:bold; +} + +.form input[readonly=True]{ + background-color:#EEE; + border:0; +} + .info{ margin-left:auto; margin-right:auto; |