From f117d443cfde75b41450b025a13bc3f50d27d9b9 Mon Sep 17 00:00:00 2001 From: Bertrand Zuchuat Date: Wed, 16 Feb 2022 08:16:56 +0100 Subject: [PATCH] documents: remove organisation tag Remove the document organisation tag from the public interface on the brief and detailed view if the display is not on the global view. * Closes #726. Co-Authored-by: Bertrand Zuchuat --- .../documents/templates/documents/record.html | 20 ++++++++++++++----- sonar/modules/documents/views.py | 4 +++- sonar/theme/templates/sonar/page.html | 5 ++++- sonar/theme/templates/sonar/search.html | 1 + 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/sonar/modules/documents/templates/documents/record.html b/sonar/modules/documents/templates/documents/record.html index 2de5483db..26d47f298 100644 --- a/sonar/modules/documents/templates/documents/record.html +++ b/sonar/modules/documents/templates/documents/record.html @@ -67,18 +67,28 @@
{{ _('document_type_' + record.documentType) }}

{{ title | nl2br | safe }}

+ {% set infoOrgSub = true %} + {%- if view != config.SONAR_APP_DEFAULT_ORGANISATION %} + {% set infoOrgSub = false if record.get('subdivisions', [])|length == 0 else true %} + {%- else %} + {% set infoOrgSub = true %} + {%- endif %} + {%- if infoOrgSub %}

- {%- for organisation in record.get('organisation', []) -%} - - {{ organisation.name }} - - {%- endfor -%} + {%- if view == config.SONAR_APP_DEFAULT_ORGANISATION %} + {%- for organisation in record.get('organisation', []) -%} + + {{ organisation.name }} + + {%- endfor -%} + {%- endif %} {%- for subdivision in record.get('subdivisions', []) -%} {{ subdivision.name | language_value }} {%- endfor -%}

+ {%- endif %} {% set contributors = record | contributors %} diff --git a/sonar/modules/documents/views.py b/sonar/modules/documents/views.py index 66cd56903..62dbe758b 100644 --- a/sonar/modules/documents/views.py +++ b/sonar/modules/documents/views.py @@ -56,7 +56,8 @@ def search(view): collection = CollectionRecord.get_record_by_pid( request.args['collection_view']) - return render_template('sonar/search.html', collection=collection) + return render_template('sonar/search.html', + collection=collection, view=view) def detail(pid, record, template=None, **kwargs): @@ -107,6 +108,7 @@ def detail(pid, record, template=None, **kwargs): return render_template(template, pid=pid, record=record, + view=kwargs.get('view'), schema_org_data=schema_org_data, google_scholar_data=google_scholar_data) diff --git a/sonar/theme/templates/sonar/page.html b/sonar/theme/templates/sonar/page.html index 1c538d9eb..e34ead71c 100755 --- a/sonar/theme/templates/sonar/page.html +++ b/sonar/theme/templates/sonar/page.html @@ -21,7 +21,10 @@ + lang="{{ current_i18n.locale.language|safe }}" dir="{{ current_i18n.locale.text_direction }}" + {%- block view %}{%- endblock %} +> + {% include config.THEME_TRACKINGCODE_TEMPLATE %} diff --git a/sonar/theme/templates/sonar/search.html b/sonar/theme/templates/sonar/search.html index 13132a541..2e7b22e6d 100644 --- a/sonar/theme/templates/sonar/search.html +++ b/sonar/theme/templates/sonar/search.html @@ -1,5 +1,6 @@ {% extends 'sonar/page.html' %} +{%- block view %} data-view="{{ view }}"{%- endblock %} {%- block body %} {% if collection %} {% include 'collections/item.html' %}