Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some bugs Add more documentation Update template tests to use bs4 Actually make templates choose the fieldset dynamically
- Loading branch information
Showing
10 changed files
with
215 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<%page args="fieldset"/> | ||
<fieldset> | ||
% if fieldset["title"]: | ||
<legend>${fieldset["title"]}</legend> | ||
% endif | ||
% for field in fieldset["fields"]: | ||
<div class="pull-left col-md-2 form-group"> | ||
${field()} ${field.label()} | ||
</div> | ||
% endfor | ||
</fieldset> |
16 changes: 12 additions & 4 deletions
16
pyramid_crud/templates/mako/bootstrap/fieldsets/horizontal.mako
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
<%page args="fieldset"/> | ||
<fieldset> | ||
<fieldset class="form-horizontal"> | ||
% if fieldset["title"]: | ||
<legend>${fieldset["title"]}</legend> | ||
% endif | ||
% for field in map(lambda f: getattr(form, f), fieldset['fields']): | ||
% if field.widget.input_type == 'hidden': | ||
% for field in fieldset['fields']: | ||
% if getattr(field.widget, 'input_type', None) == 'hidden': | ||
${field()} | ||
% else: | ||
${field.label()}: ${field()}<br /> | ||
<div class="form-group"> | ||
${field.label(class_='control-label col-sm-2')} | ||
<div class="col-sm-10"> | ||
${field(class_='form-control')} | ||
% if getattr(field, 'description', ''): | ||
<span class="help-block">${field.description}</span> | ||
% endif | ||
</div> | ||
% if field.errors: | ||
<ul> | ||
% for msg in field.errors: | ||
<li>${msg}</li> | ||
% endfor | ||
</ul> | ||
% endif | ||
</div> | ||
% endif | ||
% endfor | ||
</fieldset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.