From 0caeba897e75ddaad6c551b9085087a8e1e72449 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 9 Nov 2017 18:01:38 +0100 Subject: UI: adapt forms --- .../templates/blocks/bs_form_snippet.html | 40 ++++++++++++++++++++++ ishtar_common/templates/blocks/form_snippet.html | 16 --------- .../templates/blocks/table_form_snippet.html | 16 +++++++++ .../templates/ishtar/blocks/wizard_breadcrumb.html | 21 ++++++++++++ .../templates/ishtar/wizard/confirm_wizard.html | 11 ++---- .../templates/ishtar/wizard/default_wizard.html | 20 +++-------- ishtar_common/templates/ishtar/wizard/search.html | 12 +++++-- 7 files changed, 94 insertions(+), 42 deletions(-) create mode 100644 ishtar_common/templates/blocks/bs_form_snippet.html delete mode 100644 ishtar_common/templates/blocks/form_snippet.html create mode 100644 ishtar_common/templates/blocks/table_form_snippet.html create mode 100644 ishtar_common/templates/ishtar/blocks/wizard_breadcrumb.html (limited to 'ishtar_common/templates') diff --git a/ishtar_common/templates/blocks/bs_form_snippet.html b/ishtar_common/templates/blocks/bs_form_snippet.html new file mode 100644 index 000000000..8aa6a5333 --- /dev/null +++ b/ishtar_common/templates/blocks/bs_form_snippet.html @@ -0,0 +1,40 @@ +{% load i18n %} +{% if form.non_field_errors %} + +{%endif%} + +{% for field in form %} +{% if not field.is_hidden %} +{% if forloop.counter0|divisibleby:2 %} +{% if forloop.counter0 %} + {% endif %} +
+{% endif %} +
+ {{ field.label_tag }} + {{field|safe}} + {% if field.errors %}
+ {{ field.errors }} +
{% endif %} + {% if field.help_text %} + +
+
+ {{field.help_text}} +
+
+ {% endif %} +
+{% else %}{{field}} +{% if field.errors %}
+ {{ field.errors }} +
{% endif %} +{% endif %} +{% if forloop.counter0.last%} +
+{% endif %} +{% endfor %} diff --git a/ishtar_common/templates/blocks/form_snippet.html b/ishtar_common/templates/blocks/form_snippet.html deleted file mode 100644 index 5ee88e25f..000000000 --- a/ishtar_common/templates/blocks/form_snippet.html +++ /dev/null @@ -1,16 +0,0 @@ -{% load i18n %} - {% if form.non_field_errors %} - {{form.non_field_errors}} - {%endif%} - {% for field in form %}{% if not field.is_hidden %} - - {{ field.label_tag }} - {{ field.errors }}{{field|safe}}{% if field.help_text %} - ? - - -
{{field.help_text}}
- {%endif%}{% else %}{{field}}{% if field.errors %} - - {{field.name}} - {{ field.errors }} - {% endif %}{{field|safe}}{% endif %}{% endfor %} diff --git a/ishtar_common/templates/blocks/table_form_snippet.html b/ishtar_common/templates/blocks/table_form_snippet.html new file mode 100644 index 000000000..5ee88e25f --- /dev/null +++ b/ishtar_common/templates/blocks/table_form_snippet.html @@ -0,0 +1,16 @@ +{% load i18n %} + {% if form.non_field_errors %} + {{form.non_field_errors}} + {%endif%} + {% for field in form %}{% if not field.is_hidden %} + + {{ field.label_tag }} + {{ field.errors }}{{field|safe}}{% if field.help_text %} + ? + + +
{{field.help_text}}
+ {%endif%}{% else %}{{field}}{% if field.errors %} + + {{field.name}} - {{ field.errors }} + {% endif %}{{field|safe}}{% endif %}{% endfor %} diff --git a/ishtar_common/templates/ishtar/blocks/wizard_breadcrumb.html b/ishtar_common/templates/ishtar/blocks/wizard_breadcrumb.html new file mode 100644 index 000000000..79bca71f1 --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/wizard_breadcrumb.html @@ -0,0 +1,21 @@ +
{% csrf_token %} + +
diff --git a/ishtar_common/templates/ishtar/wizard/confirm_wizard.html b/ishtar_common/templates/ishtar/wizard/confirm_wizard.html index 7339af9a8..034d6e21a 100644 --- a/ishtar_common/templates/ishtar/wizard/confirm_wizard.html +++ b/ishtar_common/templates/ishtar/wizard/confirm_wizard.html @@ -3,14 +3,9 @@ {% load range %} {% block content %}

{{wizard_label}}

-
{% csrf_token %} - -
+ +{% include "ishtar/blocks/wizard_breadcrumb.html" %} +
{% csrf_token %}
{% block "warning_informations" %}{% endblock %} diff --git a/ishtar_common/templates/ishtar/wizard/default_wizard.html b/ishtar_common/templates/ishtar/wizard/default_wizard.html index 19076b0de..06e8be05a 100644 --- a/ishtar_common/templates/ishtar/wizard/default_wizard.html +++ b/ishtar_common/templates/ishtar/wizard/default_wizard.html @@ -6,17 +6,9 @@ {% block content %} {% block wizard_head %}

{{wizard_label}}

-{% csrf_token %} -
    -{% for step in previous_steps %} -
  • -{% endfor %} -
  • {{current_step_label}}
  • -{% for step in next_steps %} -
  • -{% endfor %} -
- + +{% include "ishtar/blocks/wizard_breadcrumb.html" %} + {% endblock %} {% block wizard_form %}
{% csrf_token %} @@ -31,14 +23,12 @@ {%if wizard.form.non_form_errors%}{%endif%} {% for formsetform in wizard.form.forms %} - {% table_form formsetform %} + {% bs_form formsetform %} {% endfor %}
{{wizard.form.non_form_errors}}
{% else %} -{% if not is_search %}{% endif %} -{% table_form wizard.form %} -{% if not is_search %}
{% endif %} + {% bs_form wizard.form %} {% endif %} {% endblock %} diff --git a/ishtar_common/templates/ishtar/wizard/search.html b/ishtar_common/templates/ishtar/wizard/search.html index e5066cf87..89ce860d4 100644 --- a/ishtar_common/templates/ishtar/wizard/search.html +++ b/ishtar_common/templates/ishtar/wizard/search.html @@ -5,9 +5,15 @@ {% endblock %} {% block content %}

{{wizard_label}}

- + + + {% if wizard.form.forms %}
-- cgit v1.2.3