From 4c9fdd6fa72cc77214292b5c435074d8bc4005e6 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 24 Nov 2017 23:13:11 +0100 Subject: UI: work on sheets --- .../blocks/window_tables/administrativacts.html | 10 +- .../blocks/window_tables/archaeologicalsites.html | 41 +++-- .../ishtar/blocks/window_tables/parcels.html | 23 +-- .../templates/ishtar/sheet_operation.html | 192 ++++++++++++--------- ishtar_common/static/bootstrap/bootstrap.css | 2 +- ishtar_common/static/media/styles.css | 13 ++ ishtar_common/templates/blocks/JQueryJqGrid.html | 27 +-- .../ishtar/blocks/sheet_creation_section.html | 22 +-- .../templates/ishtar/blocks/sheet_json.html | 6 +- .../templates/ishtar/blocks/window_field.html | 7 +- .../templates/ishtar/blocks/window_field_flex.html | 6 + .../ishtar/blocks/window_field_flex_detail.html | 6 + .../ishtar/blocks/window_field_flex_full.html | 6 + .../ishtar/blocks/window_field_flex_multiple.html | 8 + .../ishtar/blocks/window_field_flex_url.html | 7 + ishtar_common/templatetags/window_field.py | 26 +++ scss/custom.scss | 2 + 17 files changed, 263 insertions(+), 141 deletions(-) create mode 100644 ishtar_common/templates/ishtar/blocks/window_field_flex.html create mode 100644 ishtar_common/templates/ishtar/blocks/window_field_flex_detail.html create mode 100644 ishtar_common/templates/ishtar/blocks/window_field_flex_full.html create mode 100644 ishtar_common/templates/ishtar/blocks/window_field_flex_multiple.html create mode 100644 ishtar_common/templates/ishtar/blocks/window_field_flex_url.html diff --git a/archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html b/archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html index 4c41ed89e..6b651092b 100644 --- a/archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html +++ b/archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html @@ -1,14 +1,15 @@ {% load i18n %}

{{caption}}

-
-
- +
+ + + {% for act in data %} @@ -19,6 +20,5 @@ {% empty %} {% endfor %} +
{% trans "Ref." %} {% trans "Type" %} {% trans "Date" %} {% trans "Object" %}
{{act.full_ref}}
{% trans "No administrative act associated" %}
-
-
diff --git a/archaeological_operations/templates/ishtar/blocks/window_tables/archaeologicalsites.html b/archaeological_operations/templates/ishtar/blocks/window_tables/archaeologicalsites.html index d570b9db2..26b1915da 100644 --- a/archaeological_operations/templates/ishtar/blocks/window_tables/archaeologicalsites.html +++ b/archaeological_operations/templates/ishtar/blocks/window_tables/archaeologicalsites.html @@ -1,24 +1,23 @@ {% load i18n %}

{{caption}}

-
-
- - - - - - - - {% for archaeosite in data %} - - - - - - - {% empty %} - - {% endfor %} +
{% trans "Ref." %}{% trans "Name" %}{% trans "Periods" %}{% trans "Remains" %}
{{archaeosite.reference}}{{archaeosite.name}}{% for period in archaeosite.periods.all %}{{period}}{% include "blocks/comma_list.html" %}{% endfor %}{% for remain in archaeosite.remains.all %}{{remain}}{% include "blocks/comma_list.html" %}{% endfor %}
{% trans "No archaeological site associated" %}
+ + + + + + + + + {% for archaeosite in data %} + + + + + + + {% empty %} + + {% endfor %} +
{% trans "Ref." %}{% trans "Name" %}{% trans "Periods" %}{% trans "Remains" %}
{{archaeosite.reference}}{{archaeosite.name}}{% for period in archaeosite.periods.all %}{{period}}{% include "blocks/comma_list.html" %}{% endfor %}{% for remain in archaeosite.remains.all %}{{remain}}{% include "blocks/comma_list.html" %}{% endfor %}
{% trans "No archaeological site associated" %}
-
-
diff --git a/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html b/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html index 37be138b1..c52e5cd76 100644 --- a/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html +++ b/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html @@ -1,15 +1,16 @@ {% load i18n %}

{{ parcels_label }}

-
-
- - - - - - - {##} - +
{% trans "Town" %}{% trans "Year" %}{% trans "Section" %}{% trans "Parcels" %}{% trans "Owner" %}
+ + + + + + + {##} + + + {% for parcel in item.grouped_parcels %} @@ -21,5 +22,5 @@ {% empty %} {% endfor %} +
{% trans "Town" %}{% trans "Year" %}{% trans "Section" %}{% trans "Parcels" %}{% trans "Owner" %}
{{parcel.town}}
{% trans "No parcel" %}
-
diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 934a3ee19..8fbac5aa1 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -10,7 +10,7 @@ {% block content %}
-
+
{% if item.image %} @@ -35,90 +35,128 @@
-

{% trans "General"%}

- - {% field_li "Old code" item.old_code %} - {% include "ishtar/blocks/sheet_creation_section.html" %} - {% trans "Begining date" as begining_date_label %} - {% field_li begining_date_label item.start_date %} - {% field_li "Excavation end date" item.excavation_end_date|default:"-" %} - {% field_li_detail "Head scientist" item.scientist %} - {% field_li_detail "In charge" item.in_charge %} - {% field_li_multiple "Collaborators" item.collaborators %} - {% field_li_detail "Operator" item.operator %} -
  • {% if item.is_active %}{%trans "Active file"%}

    - {% else %}{%trans "Closed operation"%}
  • {% endif %} - {% if item.closing.date %}
  • {{ item.closing.date }} {%trans "by" %} {{ item.closing.user }}
  • {% endif %} - {% field_li "Type" item.operation_type %} - {% if item.surface %}
  • {{ item.surface }} m2 ({{ item.surface_ha }} ha)
  • {% endif %} - {% if item.cost %}
  • {{ item.cost }} €{% if item.cost_by_m2 %}, ({{ item.cost_by_m2 }} €/m2){%endif%}
  • {%endif%} - {% if item.duration %}
  • {{ item.duration }} {%trans "Day"%}s
  • {%endif%} - {% field_li_multiple "Remains" item.remains %} - {% field_li_multiple "Periods" item.periods %} - {% if item.QUALITY_DICT %}{% field_li "Record quality" item.record_quality|from_dict:item.QUALITY_DICT %}{% endif %} - {% if item.history_object and item.history_object.QUALITY_DICT %}{% field_li "Record quality" item.record_quality|from_dict:item.history_object.QUALITY_DICT %}{% endif %} - {% field_li "Report delivery date" item.report_delivery_date %} - {% field_li "Report processing" item.report_processing %} - {% field_li "Deadline for submission of the documentation" item.documentation_deadline %} - {% field_li "Documentation received" item.documentation_received %} - {% field_li "Deadline for submission of the finds" item.finds_deadline %} - {% field_li "Finds received" item.finds_received %} - {% field_li_detail "Associated file" item.associated_file %} - {% field_li "Responsible for planning service" item.associated_file.responsible_town_planning_service.full_address %} - {% if item.associated_file.town_planning_service %} - {% field_li "Planning service organization" item.associated_file.town_planning_service.full_address %} - {% else %} - {% field_li "Planning service organization" item.associated_file.responsible_town_planning_service.attached_to.full_address %} - {% endif %} - {% field_li "Permit type" item.associated_file.permit_type %} - {% field_li "Permit reference" item.associated_file.permit_reference %} - {% field_li "General contractor" item.associated_file.general_contractor.full_address %} - {% if item.associated_file.corporation_general_contractor %} - {% field_li "General contractor organization" item.associated_file.corporation_general_contractor.full_address %} - {% else%} - {% field_li "General contractor organization" item.associated_file.general_contractor.attached_to.full_address %} - {% endif %} - - {% field "Comment" item.comment "
    " "
    " %} - {% field "Abstract" item.abstract "
    " "
    " %} - {% field "Comment about scientific documentation" item.scientific_documentation_comment "
    " "
    " %} - - {% include "ishtar/blocks/sheet_json.html" %} -

    -
    +

    {% trans "General"%}

    +
    + {% field_flex "Old code" item.old_code %} + {% include "ishtar/blocks/sheet_creation_section.html" %} + {% trans "Begining date" as begining_date_label %} + {% field_flex begining_date_label item.start_date|date:"DATE_FORMAT" %} + {% field_flex "Excavation end date" item.excavation_end_date|date:"DATE_FORMAT"|default:"-" %} + {% field_flex_detail "Head scientist" item.scientist %} + {% field_flex_detail "In charge" item.in_charge %} + {% field_flex_multiple "Collaborators" item.collaborators %} + {% field_flex_detail "Operator" item.operator %} +
    +
    {%trans "State"%}
    +
    + {% if item.is_active %}{%trans "Active file"%} + {% else %}{%trans "Closed operation"%}{% endif %} +
    +
    + {% if item.closing.date %} +
    +
    {%trans "Closing date"%}
    +
    + {{ item.closing.date }} {%trans "by" %} {{ item.closing.user }} +
    +
    + {% endif %} + {% field_flex "Type" item.operation_type %} + {% if item.surface %} +
    +
    {%trans "Surface"%}
    +
    + {{ item.surface }} m2 ({{ item.surface_ha }} ha) +
    +
    + {% endif %} + {% if item.cost %} +
    +
    {%trans "Cost" %}
    +
    + {{ item.cost }} €{% if item.cost_by_m2 %}, ({{ item.cost_by_m2 }} €/m2){%endif%} +
    +
    + {%endif%} + {% if item.duration %} +
    +
    {%trans "Duration"%}
    +
    + {{ item.duration }} {% trans "days" %} +
    +
    + {%endif%} + {% field_flex_multiple "Remains" item.remains %} + {% field_flex_multiple "Periods" item.periods %} + {% if item.QUALITY_DICT %}{% field_flex "Record quality" item.record_quality|from_dict:item.QUALITY_DICT %}{% endif %} + {% if item.history_object and item.history_object.QUALITY_DICT %}{% field_flex "Record quality" item.record_quality|from_dict:item.history_object.QUALITY_DICT %}{% endif %} + {% field_flex "Report delivery date" item.report_delivery_date %} + {% field_flex "Report processing" item.report_processing %} + {% field_flex "Deadline for submission of the documentation" item.documentation_deadline %} + {% field_flex "Documentation received" item.documentation_received %} + {% field_flex "Deadline for submission of the finds" item.finds_deadline %} + {% field_flex "Finds received" item.finds_received %} + {% field_flex_detail "Associated file" item.associated_file %} + {% field_flex "Responsible for planning service" item.associated_file.responsible_town_planning_service.full_address %} + {% if item.associated_file.town_planning_service %} + {% field_flex "Planning service organization" item.associated_file.town_planning_service.full_address %} + {% else %} + {% field_flex "Planning service organization" item.associated_file.responsible_town_planning_service.attached_to.full_address %} + {% endif %} + {% field_flex "Permit type" item.associated_file.permit_type %} + {% field_flex "Permit reference" item.associated_file.permit_reference %} + {% field_flex "General contractor" item.associated_file.general_contractor.full_address %} + {% if item.associated_file.corporation_general_contractor %} + {% field_flex "General contractor organization" item.associated_file.corporation_general_contractor.full_address %} + {% else%} + {% field_flex "General contractor organization" item.associated_file.general_contractor.attached_to.full_address %} + {% endif %} +
    +
    + {% field_flex_full "Comment" item.comment "
    " "
    " %} + {% field_flex_full "Abstract" item.abstract "
    " "
    " %} + {% field_flex_full "Comment about scientific documentation" item.scientific_documentation_comment "
    " "
    " %} + {% include "ishtar/blocks/sheet_json.html" %} +
    {% if item.virtual_operation %} -

    {% trans "This operation is virtual." %}

    + {% endif %} {% if not item.code_patriarche %} -

    {%trans "Patriarche OA code not yet recorded!"%}

    + {% endif %} - -{% endif %} -

    {{rel.relation_type}}

    {% endif %} +

    {{rel.relation_type}}

    +
    {% endifchanged %} +
    + + + {{rel.right_record}} +
    +{% if forloop.last %} +
    {% endif %} {% endfor %} {% endif %} @@ -175,18 +213,18 @@

    {% trans "Administrative acts" %}

    {% trans "Parcels" %}

    {% trans "Context records" %}

    {% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/sheet_json.html b/ishtar_common/templates/ishtar/blocks/sheet_json.html index 31e6acb84..6aaf4bae7 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_json.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_json.html @@ -4,8 +4,8 @@

    {{json_section}}

    {% endif %} {% for label, value in json_fields %} -{% if forloop.first %}{% endif %} +{% if forloop.first %}
    {% endif %} + {% field_flex label value %} +{% if forloop.last %}
    {% endif %} {% endfor %} {% endfor %} diff --git a/ishtar_common/templates/ishtar/blocks/window_field.html b/ishtar_common/templates/ishtar/blocks/window_field.html index b52ed78ee..097ae3fd2 100644 --- a/ishtar_common/templates/ishtar/blocks/window_field.html +++ b/ishtar_common/templates/ishtar/blocks/window_field.html @@ -1,3 +1,6 @@ -{% load i18n %}{% if data %}{% if li %}
  • {% else %}

    {% endif %} -{{pre_data|safe}}{{data|linebreaksbr}}{{post_data|safe}}{% if li %}

  • {% else %}

    {% endif %} +{% load i18n %}{% if data %}{% if li %}
  • {% elif flex %} +
    {% else %}

    {% endif %} + + {{pre_data|safe}}{{data|linebreaksbr}}{{post_data|safe }} + {% if li %}

  • {% elif flex %}{% else %}

    {% endif %} {% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/window_field_flex.html b/ishtar_common/templates/ishtar/blocks/window_field_flex.html new file mode 100644 index 000000000..e6bd03a85 --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/window_field_flex.html @@ -0,0 +1,6 @@ +{% load i18n %}{% if data %} +
    +
    {% trans caption %}
    +
    {{pre_data|safe}}{{data|linebreaksbr}}{{post_data|safe }}
    +
    +{% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/window_field_flex_detail.html b/ishtar_common/templates/ishtar/blocks/window_field_flex_detail.html new file mode 100644 index 000000000..5968f9afa --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/window_field_flex_detail.html @@ -0,0 +1,6 @@ +{% load i18n %}{% if item %} +
    +
    {% trans caption %}
    +
    {{item}}{{link}}
    +
    +{% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/window_field_flex_full.html b/ishtar_common/templates/ishtar/blocks/window_field_flex_full.html new file mode 100644 index 000000000..f44cdc6fd --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/window_field_flex_full.html @@ -0,0 +1,6 @@ +{% load i18n %}{% if data %} +
    +
    {% trans caption %}
    +
    {{pre_data|safe}}{{data|linebreaksbr}}{{post_data|safe }}
    +
    +{% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/window_field_flex_multiple.html b/ishtar_common/templates/ishtar/blocks/window_field_flex_multiple.html new file mode 100644 index 000000000..60f6361b7 --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/window_field_flex_multiple.html @@ -0,0 +1,8 @@ +{% load i18n %}{% if data.count %} +
    +
    {% trans caption %}
    +
    {% for d in data.all %} + {% if forloop.counter0 %} ; {% endif %}{{ d }} + {% endfor %}
    +
    +{% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/window_field_flex_url.html b/ishtar_common/templates/ishtar/blocks/window_field_flex_url.html new file mode 100644 index 000000000..59f612bc6 --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/window_field_flex_url.html @@ -0,0 +1,7 @@ +{% load i18n %}{% if link %} +
    +
    {% trans caption %}
    +
    + {% if link_name %}{{link_name}}{% else %}{{link}}{% endif %} +
    +{% endif%} diff --git a/ishtar_common/templatetags/window_field.py b/ishtar_common/templatetags/window_field.py index 022986493..8536b7595 100644 --- a/ishtar_common/templatetags/window_field.py +++ b/ishtar_common/templatetags/window_field.py @@ -21,6 +21,16 @@ def field_li(caption, data, pre_data='', post_data=''): return field(caption, data, pre_data, post_data, li=True) +@register.inclusion_tag('ishtar/blocks/window_field_flex.html') +def field_flex(caption, data, pre_data='', post_data=''): + return field(caption, data, pre_data, post_data) + + +@register.inclusion_tag('ishtar/blocks/window_field_flex_full.html') +def field_flex_full(caption, data, pre_data='', post_data=''): + return field(caption, data, pre_data, post_data) + + @register.inclusion_tag('ishtar/blocks/window_field_url.html') def field_url(caption, link, link_name='', li=False): if link: @@ -35,6 +45,11 @@ def field_li_url(caption, link, link_name=''): return field_url(caption, link, link_name, li=True) +@register.inclusion_tag('ishtar/blocks/window_field_flex_url.html') +def field_flex_url(caption, link, link_name=''): + return field_url(caption, link, link_name) + + @register.inclusion_tag('ishtar/blocks/window_field_multiple.html') def field_multiple(caption, data, li=False): return {'caption': caption, 'data': data, 'li': li} @@ -45,8 +60,14 @@ def field_li_multiple(caption, data): return field_multiple(caption, data, li=True) +@register.inclusion_tag('ishtar/blocks/window_field_flex_multiple.html') +def field_flex_multiple(caption, data): + return field_multiple(caption, data) + + @register.inclusion_tag('ishtar/blocks/window_field_detail.html') def field_detail(caption, item, li=False): + print(caption, item) return {'caption': caption, 'item': item, 'link': link_to_window(item), 'li': li} @@ -54,3 +75,8 @@ def field_detail(caption, item, li=False): @register.inclusion_tag('ishtar/blocks/window_field_detail.html') def field_li_detail(caption, item): return field_detail(caption, item, li=True) + + +@register.inclusion_tag('ishtar/blocks/window_field_flex_detail.html') +def field_flex_detail(caption, item): + return field_detail(caption, item) diff --git a/scss/custom.scss b/scss/custom.scss index e838d114c..0419d6b58 100644 --- a/scss/custom.scss +++ b/scss/custom.scss @@ -21,6 +21,8 @@ h4, .h4 { font-size: 1.1rem; } +.sheet h4 { color: $text-muted; } + .container{ margin-top: 1em; margin-bottom: 5em; -- cgit v1.2.3