summaryrefslogtreecommitdiff
path: root/ishtar_common/templates/ishtar
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2021-04-28 09:55:25 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-10-25 12:06:02 +0200
commit2d0512c72b2a8feb6fa10c3cd8b8c53bc74a9ba6 (patch)
tree588be51c6025952afff12e09f87edbc2f22600f7 /ishtar_common/templates/ishtar
parentbb4f88c00e1ef2aef1fe0038c7fdb1855f455130 (diff)
downloadIshtar-2d0512c72b2a8feb6fa10c3cd8b8c53bc74a9ba6.tar.bz2
Ishtar-2d0512c72b2a8feb6fa10c3cd8b8c53bc74a9ba6.zip
WIP: preventive forms
Diffstat (limited to 'ishtar_common/templates/ishtar')
-rw-r--r--ishtar_common/templates/ishtar/forms/base_form.html50
-rw-r--r--ishtar_common/templates/ishtar/forms/document.html51
2 files changed, 55 insertions, 46 deletions
diff --git a/ishtar_common/templates/ishtar/forms/base_form.html b/ishtar_common/templates/ishtar/forms/base_form.html
new file mode 100644
index 000000000..fb1fc997f
--- /dev/null
+++ b/ishtar_common/templates/ishtar/forms/base_form.html
@@ -0,0 +1,50 @@
+{% extends "base.html" %}
+{% load i18n inline_formset table_form from_dict %}
+{% block extra_head %}
+{{form.media}}
+{% endblock %}
+
+{% block pre_container %}
+<form enctype="multipart/form-data" action="." method="post"{% if confirm %}
+ onsubmit='return confirm("{{confirm}}");'{% endif %}>{% csrf_token %}
+{% endblock %}
+{% block content %}
+<h2>{{page_name}}</h2>
+<div class='form{% if not form.SEARCH_AND_SELECT %} container{% endif %}'>
+ {% if form.non_field_errors or form.errors %}
+ <div class="alert alert-danger">
+ <div><i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
+ {% trans "Error on validation. Check all your fields. Modification not saved." %}
+ </div>
+ {% for key, error_details in form.errors.items %}
+ {% with field=key|from_dict:form.fields %}<strong>{{ field.label }}</strong>{{error_details}}{% endwith %}
+ {% endfor %}
+ </div>
+ {% endif %}
+ {% block form_head %}
+ {% endblock %}
+ {% bs_form form 0 True %}
+ {% for inline in inline_forms %}
+ {% bs_formset inline 0 True %}
+ {% endfor %}
+</div>
+{% endblock %}
+
+{% block footer %}
+<div id="footer">
+ {% if form.SEARCH_AND_SELECT %}
+ <p class="confirm-message">{% trans "Search and select an item in the table" %}</p>
+ {% endif %}
+ <div id='validation-bar' class="row text-center">
+ <div class="col-sm">
+ <button type="submit" id="submit_form" name='validate'
+ value="validate" class="btn btn-success">
+ {% if submit_label %}{{submit_label}}{% else%}{% trans "Validate" %}{% endif %}
+ </button>
+ </div>
+ </div>
+ {% include 'ishtar/blocks/footer.html' %}
+</div>
+</form>
+{% endblock %}
+
diff --git a/ishtar_common/templates/ishtar/forms/document.html b/ishtar_common/templates/ishtar/forms/document.html
index 8e2683a03..fe3df8c74 100644
--- a/ishtar_common/templates/ishtar/forms/document.html
+++ b/ishtar_common/templates/ishtar/forms/document.html
@@ -1,48 +1,7 @@
-{% extends "base.html" %}
-{% load i18n inline_formset table_form from_dict %}
-{% block extra_head %}
-{{form.media}}
-{% endblock %}
-
-{% block pre_container %}
-<form enctype="multipart/form-data" action="." method="post"{% if confirm %}
- onsubmit='return confirm("{{confirm}}");'{% endif %}>{% csrf_token %}
-{% endblock %}
-{% block content %}
-<h2>{{page_name}}</h2>
-<div class='form{% if not form.SEARCH_AND_SELECT %} container{% endif %}'>
- {% if form.non_field_errors or form.errors %}
- <div class="alert alert-danger">
- <div><i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
- {% trans "Error on validation. Check all your fields. Modification not saved." %}
- </div>
- {% for key, error_details in form.errors.items %}
- {% with field=key|from_dict:form.fields %}<strong>{{ field.label }}</strong>{{error_details}}{% endwith %}
- {% endfor %}
- </div>
- {% endif %}
- {% if item_related_label %}<div class="alert alert-info">
+{% extends "ishtar/forms/base_form.html" %}
+{% load i18n %}
+{% block form_head %}
+{% if item_related_label %}<div class="alert alert-info">
<strong>{% trans "Related items" %}{% trans ":" %}</strong> {{ item_related_label }}
- </div>{% endif %}
- {% bs_form form 0 True %}
-</div>
-{% endblock %}
-
-{% block footer %}
-<div id="footer">
- {% if form.SEARCH_AND_SELECT %}
- <p class="confirm-message">{% trans "Search and select an item in the table" %}</p>
- {% endif %}
- <div id='validation-bar' class="row text-center">
- <div class="col-sm">
- <button type="submit" id="submit_form" name='validate'
- value="validate" class="btn btn-success">
- {% if submit_label %}{{submit_label}}{% else%}{% trans "Validate" %}{% endif %}
- </button>
- </div>
- </div>
- {% include 'ishtar/blocks/footer.html' %}
-</div>
-</form>
+</div>{% endif %}
{% endblock %}
-