From 4791b385c15839a3a5cff1bb687f43f0d067f774 Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Tue, 15 Jan 2019 23:03:35 -0200 Subject: [PATCH] =?UTF-8?q?ajustes=20do=20bot=C3=A3o=20salvar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/crispy_layout_mixin.py | 8 +++++--- sapl/templates/bootstrap4/layout/formactions.html | 13 +++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 sapl/templates/bootstrap4/layout/formactions.html diff --git a/sapl/crispy_layout_mixin.py b/sapl/crispy_layout_mixin.py index 0c9debb77..9c04452ac 100644 --- a/sapl/crispy_layout_mixin.py +++ b/sapl/crispy_layout_mixin.py @@ -1,6 +1,5 @@ from math import ceil -import rtyaml from crispy_forms.bootstrap import FormActions from crispy_forms.helper import FormHelper from crispy_forms.layout import HTML, Div, Fieldset, Layout, Submit @@ -8,6 +7,7 @@ from django import template from django.core.urlresolvers import reverse, reverse_lazy from django.utils import formats from django.utils.translation import ugettext as _ +import rtyaml def heads_and_tails(list_of_lists): @@ -43,10 +43,12 @@ def form_actions(more=[Div(css_class='clearfix')], doubleclick = 'return true;' return FormActions( + *more, Submit(name, label, css_class=css_class, # para impedir resubmissão do form onclick=doubleclick), - *more) + css_class='form-group row justify-content-between' + ) class SaplFormLayout(Layout): @@ -58,7 +60,7 @@ class SaplFormLayout(Layout): if not buttons: buttons = form_actions(label=save_label, more=[ HTML('%s' % cancel_label) + ' class="btn btn-dark">%s' % cancel_label) if cancel_label else None]) _fields = list(to_fieldsets(fields)) diff --git a/sapl/templates/bootstrap4/layout/formactions.html b/sapl/templates/bootstrap4/layout/formactions.html new file mode 100644 index 000000000..3ab247fbe --- /dev/null +++ b/sapl/templates/bootstrap4/layout/formactions.html @@ -0,0 +1,13 @@ + + {% if label_class %} +
+ {% endif %} + + {% if field_class %} +
+ {{ fields_output|safe }} +
+ {% else %} + {{ fields_output|safe }} + {% endif %} +