From eb7e96c07ad61a6e66fa8fd94f80fa317a99afb0 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 26 Nov 2020 13:06:35 +0100 Subject: Refactor custom widgets templates - ISSN/ISBN check --- .../templates/blocks/CentimeterMeterWidget.html | 21 ------------------ .../templates/blocks/GramKilogramWidget.html | 21 ------------------ .../templates/blocks/SquareMeterWidget.html | 21 ------------------ ishtar_common/templates/ishtar/forms/document.html | 12 ++++++++++- .../templates/widgets/CentimeterMeterWidget.html | 21 ++++++++++++++++++ .../templates/widgets/CheckTextWidget.html | 25 ++++++++++++++++++++++ .../templates/widgets/GramKilogramWidget.html | 21 ++++++++++++++++++ .../templates/widgets/SquareMeterWidget.html | 21 ++++++++++++++++++ 8 files changed, 99 insertions(+), 64 deletions(-) delete mode 100644 ishtar_common/templates/blocks/CentimeterMeterWidget.html delete mode 100644 ishtar_common/templates/blocks/GramKilogramWidget.html delete mode 100644 ishtar_common/templates/blocks/SquareMeterWidget.html create mode 100644 ishtar_common/templates/widgets/CentimeterMeterWidget.html create mode 100644 ishtar_common/templates/widgets/CheckTextWidget.html create mode 100644 ishtar_common/templates/widgets/GramKilogramWidget.html create mode 100644 ishtar_common/templates/widgets/SquareMeterWidget.html (limited to 'ishtar_common/templates') diff --git a/ishtar_common/templates/blocks/CentimeterMeterWidget.html b/ishtar_common/templates/blocks/CentimeterMeterWidget.html deleted file mode 100644 index 00c1614b5..000000000 --- a/ishtar_common/templates/blocks/CentimeterMeterWidget.html +++ /dev/null @@ -1,21 +0,0 @@ -
- -
-
- {{unit}} (0 m) -
-
-
- diff --git a/ishtar_common/templates/blocks/GramKilogramWidget.html b/ishtar_common/templates/blocks/GramKilogramWidget.html deleted file mode 100644 index 27c066d13..000000000 --- a/ishtar_common/templates/blocks/GramKilogramWidget.html +++ /dev/null @@ -1,21 +0,0 @@ -
- -
-
- {{unit}} (0 kg) -
-
-
- diff --git a/ishtar_common/templates/blocks/SquareMeterWidget.html b/ishtar_common/templates/blocks/SquareMeterWidget.html deleted file mode 100644 index 09e93b425..000000000 --- a/ishtar_common/templates/blocks/SquareMeterWidget.html +++ /dev/null @@ -1,21 +0,0 @@ -
- -
-
- {{unit}} (0 ha) -
-
-
- diff --git a/ishtar_common/templates/ishtar/forms/document.html b/ishtar_common/templates/ishtar/forms/document.html index b3a9a8e15..ed5a39daf 100644 --- a/ishtar_common/templates/ishtar/forms/document.html +++ b/ishtar_common/templates/ishtar/forms/document.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% load i18n inline_formset table_form %} +{% load i18n inline_formset table_form from_dict %} {% block extra_head %} {{form.media}} {% endblock %} @@ -11,9 +11,19 @@ {% block content %}

{{page_name}}

+ {% if form.non_field_errors or form.errors %} +
+
+ {% trans "Error on validation. Check all your fields. Modification not saved." %} +
{% for error in form.non_field_errors %}

{{ error }}

{% endfor %} + {% for key, error_details in form.errors.items %} + {% with field=key|from_dict:form.fields %}{{ field.label }}{{error_details}}{% endwith %} + {% endfor %} +
+ {% endif %} {% bs_form form %}
{% endblock %} diff --git a/ishtar_common/templates/widgets/CentimeterMeterWidget.html b/ishtar_common/templates/widgets/CentimeterMeterWidget.html new file mode 100644 index 000000000..00c1614b5 --- /dev/null +++ b/ishtar_common/templates/widgets/CentimeterMeterWidget.html @@ -0,0 +1,21 @@ +
+ +
+
+ {{unit}} (0 m) +
+
+
+ diff --git a/ishtar_common/templates/widgets/CheckTextWidget.html b/ishtar_common/templates/widgets/CheckTextWidget.html new file mode 100644 index 000000000..593fcbb5b --- /dev/null +++ b/ishtar_common/templates/widgets/CheckTextWidget.html @@ -0,0 +1,25 @@ +
+ +
+
+ + +
+
+
+ diff --git a/ishtar_common/templates/widgets/GramKilogramWidget.html b/ishtar_common/templates/widgets/GramKilogramWidget.html new file mode 100644 index 000000000..27c066d13 --- /dev/null +++ b/ishtar_common/templates/widgets/GramKilogramWidget.html @@ -0,0 +1,21 @@ +
+ +
+
+ {{unit}} (0 kg) +
+
+
+ diff --git a/ishtar_common/templates/widgets/SquareMeterWidget.html b/ishtar_common/templates/widgets/SquareMeterWidget.html new file mode 100644 index 000000000..09e93b425 --- /dev/null +++ b/ishtar_common/templates/widgets/SquareMeterWidget.html @@ -0,0 +1,21 @@ +
+ +
+
+ {{unit}} (0 ha) +
+
+
+ -- cgit v1.2.3