From 60422080838102e4c78e930126e98711734ed0e1 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 16 Jan 2018 18:51:38 +0100 Subject: UI: improve parcel form --- .../templates/ishtar/wizard/default_wizard.html | 13 +++++++---- .../templates/ishtar/wizard/parcels_wizard.html | 27 +++++++++++++++------- ishtar_common/widgets.py | 12 ++++++---- 3 files changed, 34 insertions(+), 18 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/templates/ishtar/wizard/default_wizard.html b/ishtar_common/templates/ishtar/wizard/default_wizard.html index 1a774ad49..6c9193966 100644 --- a/ishtar_common/templates/ishtar/wizard/default_wizard.html +++ b/ishtar_common/templates/ishtar/wizard/default_wizard.html @@ -19,14 +19,17 @@ {% block form_detail %} {% if wizard.form.forms %} {{ wizard.form.management_form }} -
- - {%if wizard.form.non_form_errors%}{%endif%} + {% if wizard.form.non_form_errors %} + + {% endif %} {% for formsetform in wizard.form.forms %} {% bs_form formsetform %} {% endfor %} - -
{{wizard.form.non_form_errors}}
+ {% else %} {% bs_form wizard.form %} {% endif %} diff --git a/ishtar_common/templates/ishtar/wizard/parcels_wizard.html b/ishtar_common/templates/ishtar/wizard/parcels_wizard.html index 28ec962f4..6a553d3c1 100644 --- a/ishtar_common/templates/ishtar/wizard/parcels_wizard.html +++ b/ishtar_common/templates/ishtar/wizard/parcels_wizard.html @@ -1,5 +1,5 @@ {% extends "ishtar/wizard/default_wizard.html" %} -{% load i18n range inline_formset %} +{% load i18n range inline_formset table_form %} {% block extra_head %} {{wizard.form.media}} {% endblock %} @@ -9,19 +9,30 @@ {{ wizard.form.media }} {{ wizard.management_form }} {{ wizard.form.management_form }} -{% if automatic_parcel_association %}

{% endif %} - {%if wizard.form.non_form_errors%} - - -
{{wizard.form.non_form_errors}}
{%endif%} -{{wizard.form.selection_form}} + {% if automatic_parcel_association %} + + {% endif %} + {% if wizard.form.non_form_errors %} + {%endif%} + + {% bs_form wizard.form.selection_form %} + {% for field in wizard.form.forms.0 %}{{ field.label_tag }}{% endfor %} {% inline_formset 'Parcels' wizard.form.forms False %}
({% trans "all"%} )
{% if add_all %}

{% endif %} -

+ +
+ +
{{ previous_fields|safe }} {% block "footer" %} diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index 59a034c00..84a58c98c 100644 --- a/ishtar_common/widgets.py +++ b/ishtar_common/widgets.py @@ -251,11 +251,13 @@ class Select2MultipleField(forms.MultipleChoiceField): class DeleteWidget(forms.CheckboxInput): def render(self, name, value, attrs=None, renderer=None): final_attrs = flatatt( - self.build_attrs(attrs, {"name": name, "value": '1'})) - output = [''] - output.append(u"%s" % (final_attrs, _("Delete"))) - output.append('') - return mark_safe('\n'.join(output)) + self.build_attrs( + attrs, {"name": name, "value": '1', + 'class': "btn btn-danger"}) + ) + output = u"%s" % (final_attrs, _("Delete")) + + return mark_safe(output) class ImageFileInput(ClearableFileInput): -- cgit v1.2.3