From bed65ee5480783ee979d31622effd7a7a78718cf Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 19 Jan 2018 16:56:15 +0100 Subject: UI : improve forms - sheet source --- .../templates/ishtar/sheet_operation.html | 2 +- .../templates/ishtar/sheet_operationsource.html | 4 +- ishtar_common/forms.py | 1 + .../templates/blocks/bs_form_snippet.html | 5 +- ishtar_common/templates/ishtar/sheet.html | 6 +-- ishtar_common/templates/ishtar/sheet_source.html | 59 ++++++++++++---------- 6 files changed, 41 insertions(+), 36 deletions(-) diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 0052dde7b..1f3e9e157 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -1,7 +1,7 @@ {% extends "ishtar/sheet.html" %} {% load i18n window_tables window_header window_ope_tables window_field from_dict %} -{% block head_title %}{% trans "Operation:" %} {{item.short_label}}{% endblock %} +{% block head_title %}{% trans "Operation" %} - {{item.short_label}}{% endblock %} {% block toolbar %} {% window_nav item window_id 'show-operation' 'operation_modify' 'show-historized-operation' 'revert-operation' previous next 1 %} diff --git a/archaeological_operations/templates/ishtar/sheet_operationsource.html b/archaeological_operations/templates/ishtar/sheet_operationsource.html index 55c48b319..91cb483f0 100644 --- a/archaeological_operations/templates/ishtar/sheet_operationsource.html +++ b/archaeological_operations/templates/ishtar/sheet_operationsource.html @@ -1,7 +1,7 @@ {% extends "ishtar/sheet_source.html" %} {% load i18n window_field window_header link_to_window %} -{% block head_title %}{% trans "Operation source" %}{% endblock %} +{% block head_title %}{% trans "Operation source" %} - {{item.title}} - {{item.owner}}{% endblock %} {% block window_nav %} {% window_nav item window_id 'show-operationsource' 'operation_source_modify' %} @@ -9,5 +9,5 @@ {% block related %} {% trans "Related operation" as related_item_label %} -{% field related_item_label item.owner '' item.owner|link_to_window %} +{% field_flex related_item_label item.owner '' item.owner|link_to_window %} {% endblock %} diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index 748c3f6f3..038e9bd07 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -333,6 +333,7 @@ def get_form_selection( raise forms.ValidationError(self._not_selected_error) return cleaned_data attrs['clean'] = clean + attrs['SEARCH_AND_SELECT'] = True return type(class_name, (forms.Form,), attrs) diff --git a/ishtar_common/templates/blocks/bs_form_snippet.html b/ishtar_common/templates/blocks/bs_form_snippet.html index dc24b2849..c636465f3 100644 --- a/ishtar_common/templates/blocks/bs_form_snippet.html +++ b/ishtar_common/templates/blocks/bs_form_snippet.html @@ -13,10 +13,9 @@ {% endfor %} {% for field in form.visible_fields %} -{% if field.name == 'pk' %} +{% if form.SEARCH_AND_SELECT %} {{field}} {% elif field.name == 'search_vector' and forloop.counter0 == 0 %} -
@@ -63,8 +62,6 @@
{% endif %}
{% endif %} - - {% include "blocks/bs_field_snippet.html" %} {% if forloop.last %} {% if search and forloop.counter0 >= 1 %} diff --git a/ishtar_common/templates/ishtar/sheet.html b/ishtar_common/templates/ishtar/sheet.html index 80bb1d4d1..ee57d312d 100644 --- a/ishtar_common/templates/ishtar/sheet.html +++ b/ishtar_common/templates/ishtar/sheet.html @@ -12,7 +12,7 @@