improve fieldset template
This commit is contained in:
parent
af544089b7
commit
b3e6b6eb66
1 changed files with 26 additions and 20 deletions
|
@ -9,27 +9,33 @@
|
|||
|
||||
% for field in fieldset.render_fields.itervalues():
|
||||
|
||||
<div class="field-wrapper ${field.name}">
|
||||
% for error in field.errors:
|
||||
<div class="field-error">${error}</div>
|
||||
% endfor
|
||||
${field.label_tag()|n}
|
||||
<div class="field">
|
||||
${field.render()|n}
|
||||
</div>
|
||||
% if 'instructions' in field.metadata:
|
||||
<span class="instructions">${field.metadata['instructions']}</span>
|
||||
% endif
|
||||
</div>
|
||||
% if field.requires_label:
|
||||
<div class="field-wrapper ${field.name}">
|
||||
% for error in field.errors:
|
||||
<div class="field-error">${error}</div>
|
||||
% endfor
|
||||
${field.label_tag()|n}
|
||||
<div class="field">
|
||||
${field.render()|n}
|
||||
</div>
|
||||
% if 'instructions' in field.metadata:
|
||||
<span class="instructions">${field.metadata['instructions']}</span>
|
||||
% endif
|
||||
</div>
|
||||
|
||||
% if (fieldset.focus == field or fieldset.focus is True) and not _focus_rendered:
|
||||
% if not field.is_readonly():
|
||||
<script language="javascript" type="text/javascript">
|
||||
$(function() {
|
||||
$('#${field.renderer.name}').focus();
|
||||
});
|
||||
</script>
|
||||
<% _focus_rendered = True %>
|
||||
% if not _focus_rendered and (fieldset.focus == field or fieldset.focus is True):
|
||||
% if not field.is_readonly():
|
||||
<script language="javascript" type="text/javascript">
|
||||
$(function() {
|
||||
% if hasattr(field.renderer, 'focus_name'):
|
||||
$('#${field.renderer.focus_name}').focus();
|
||||
% else:
|
||||
$('#${field.renderer.name}').focus();
|
||||
% endif
|
||||
});
|
||||
</script>
|
||||
<% _focus_rendered = True %>
|
||||
% endif
|
||||
% endif
|
||||
% endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue