From 18234e710235eacb83b095bc7eb48c70e09de020 Mon Sep 17 00:00:00 2001 From: Birger Schacht Date: Tue, 21 Nov 2023 10:45:29 +0100 Subject: [PATCH] fix: cleanup generic edit template The card-header and card-body divs are now being enclosed in blocks that can be used to override them. The object_texts block was removed, as there is no variable anymore in the context. All the if/else checks if there is an instance are now removed, given that the createviews now have their own template. --- .../templates/apis_entities/edit_generic.html | 354 ++++++++---------- 1 file changed, 157 insertions(+), 197 deletions(-) diff --git a/apis_core/apis_entities/templates/apis_entities/edit_generic.html b/apis_core/apis_entities/templates/apis_entities/edit_generic.html index 9c3414a0c..b03db94b9 100644 --- a/apis_core/apis_entities/templates/apis_entities/edit_generic.html +++ b/apis_core/apis_entities/templates/apis_entities/edit_generic.html @@ -1,5 +1,7 @@ {% extends basetemplate %} {% load static %} +{% load django_tables2 %} +{% load crispy_forms_tags %} {% block scriptHeader %} {{ block.super }} @@ -10,221 +12,182 @@ {% endblock %} -{% block Titel %}Create a {{ entity_type|title }}{% endblock %} - -{% load static %} - {% block content %} - {% load django_tables2 %} +
+
- {% if instance %} -
-
+ {% block card-header %} -
-
-
- {% endif %} - - {% load crispy_forms_tags %} -
-
- - {% if instance %} -

- Edit the Entity -

- {% else %} -

- create new object type: {{ entity_type|title }} -

- {% endif %} -
-
-
- - {% if apis_bibsonomy %} - - {% endif %} - - {% crispy form %} - - {% block linkedOpenData %} + {% block card-header-content %} +

+ + {{ entity_type }}s + + {{ instance }} + visibility + + + database + +

+ {% endblock card-header-content %} - {% if object_lod %} -
- -
-
-

- {% for lod in object_lod %} - - {% if forloop.last %} - {{ lod.uri }} - {% else %} - {{ lod.uri }} -
- {% endif %} - - {% endfor %} -

-
-
-
- {% endif %} +
+ {% endblock card-header %} - {% endblock %} + {% block card-body %} +
- {% block editbuttons %} -
+ {% block card-body-content %} +
+
+
+
+

+ Edit the Entity +

+
+
+ - {% if instance %} - - - Delete - Create new {{ entity_type|title }} - {% else %} - {% endif %} -
- {% endblock editbuttons %} - -
- - {% if instance %} -
-
- {% endif %} + {% crispy form %} - {% if instance %} -
-
-
-

- the Entity is related to -

-
-
-
+ {% block linkedOpenData %} - {% block additional_accordion %} -
- -
-
- {% load crispy_forms_tags %} - {% crispy form_merge_with form_merge_with.helper %} + {% if object_lod %} +
+ +
+
+

+ {% for lod in object_lod %} + + {% if forloop.last %} + {{ lod.uri }} + {% else %} + {{ lod.uri }} +
+ {% endif %} + + {% endfor %} +

+
+ {% endif %} + + {% endblock %} + + {% block editbuttons %} + -
- {% endblock additional_accordion %} + {% endblock editbuttons %} - {% block relations %} - {% for obj in right_card %} -
- +
+
+
+
+
+

+ the Entity is related to +

+
+
+
+ + {% block additional_accordion %} +
+ -
-
{% render_table obj.1 %}
+
+
+ {% load crispy_forms_tags %} + {% crispy form_merge_with form_merge_with.helper %} +
- {% endfor %} - {% endblock relations %} +
+ {% endblock additional_accordion %} + + {% block relations %} + {% for obj in right_card %} +
+ +
+
{% render_table obj.1 %}
+
+
+ {% endfor %} + {% endblock relations %} +
- {% endif %} - - {% if instance %}
-
- {% endif %} + {% endblock card-body-content %} - {% if object_texts %} -
-
- - {% if ann_proj_form %} -
{% crispy ann_proj_form ann_proj_form.helper %}
- {% endif %} - - {% for txt in object_texts %} -
-
-
{{ txt.text|safe }}
-
-
-
- {% endfor %} -
-
- {% endif %} - - {% load crispy_forms_tags %} - {% endblock %} + {% endblock card-body %} - {% block scripts %} - {{ block.super }} +
+
+{% endblock %} - {% if instance %} - - + - + - + - + - + - + - {% endblock %} + +{% endblock %}