Support horizontal and inline form layouts
With these changes, FormWidget.css_class can be set to form-horizontal or form-inline to trigger bootstrap's alternative form layouts.
For horizontal forms the columns widths are controlled by a new setting MappingWidget.column_classes (a two-tuple of CSS classes).
Within a horizontal form, if .column_classes is a false value, classes will be set in order to simulate the default "vertical" layout for that mapping (this involves setting both the label and control columns widths to col-xs-12 and omitting the control-label class from the control label.) By default MappingWidget.column_classes is None, while FormWidget.column_classes is not, so that the top level form will be laid out horizontally, while any nested mappings will use a faux-vertical layout. (This complication is necessary since, within a .form-horizontal, all .form_groups must be structured in the horizontal style (with columns).)
This is PR #187 rebased from the defunct deform2 branch onto the current master. See #187 for further notes and context.
Thank you for your pull request.
I am the new Deform project maintainer. I apologize the issue of this pull request not being commented earlier. Deform project is again under activate maintenance.
This is issue tracker / pull request clean to prepare a new release.
I am willing to merge this pull request. However I hope to have some discussion first.
Things I agree
- Horizontal forms is a feature that should go into Deform core
Things I'd like to discuss
- Would it be possible to move some of template functionality to a separate template (e.g. horizontal-form.pt) to maintain the core set of templates more minimal, clean and especially free from variables and conditional checks
If this is an abandon pull request and there is no new feedback I will close this pull request in 30 days.
I'm preparing a Deform 3.0 release. If someone would like to complete this PR, per @miohtama's comments, I will include it.
I've assigned this PR to the Deform 2.1.0 milestone.
For Deform 3.x, we will have a new repository for custom Deform templates that implement horizontal layouts and any other widget that is not provided with Deform.