|
|
@ -1,15 +1,15 @@ |
|
|
|
from crispy_forms_foundation.layout import (HTML, Column, Div, Fieldset, |
|
|
|
Layout, Row, Submit) |
|
|
|
from crispy_forms.bootstrap import FormActions |
|
|
|
from crispy_forms.layout import Submit, Layout, Div, Fieldset, HTML |
|
|
|
from django.utils.translation import ugettext as _ |
|
|
|
|
|
|
|
|
|
|
|
def to_column(name_span): |
|
|
|
fieldname, span = name_span |
|
|
|
return Column(fieldname, css_class='large-%d' % span) |
|
|
|
return Div(fieldname, css_class='col-sm-%d' % span) |
|
|
|
|
|
|
|
|
|
|
|
def to_row(names_spans): |
|
|
|
return Row(*list(map(to_column, names_spans))) |
|
|
|
return Div(*map(to_column, names_spans), css_class='row-fluid') |
|
|
|
|
|
|
|
|
|
|
|
def to_fieldsets(fields): |
|
|
@ -25,13 +25,9 @@ def to_fieldsets(fields): |
|
|
|
class SaplFormLayout(Layout): |
|
|
|
|
|
|
|
def __init__(self, *fields): |
|
|
|
buttons = Div( |
|
|
|
buttons = FormActions( |
|
|
|
Submit('save', _('Enviar'), css_class='btn btn-primary '), |
|
|
|
HTML('<a href="{{ view.cancel_url }}"' |
|
|
|
' class="button radius alert">%s</a>' % _('Cancelar')), |
|
|
|
Submit('submit', _('Enviar'), |
|
|
|
css_class='button radius success right'), |
|
|
|
css_class='radius clearfix' |
|
|
|
) |
|
|
|
_fields = list(to_fieldsets(fields)) + \ |
|
|
|
[Row(Column(buttons, css_class='clearfix'))] |
|
|
|
' class="btn btn-inverse">%s</a>' % _('Cancelar'))) |
|
|
|
_fields = list(to_fieldsets(fields)) + [to_row([(buttons, 12)])] |
|
|
|
super(SaplFormLayout, self).__init__(*_fields) |
|
|
|