Skip to content

Commit

Permalink
documents: remove organisation tag
Browse files Browse the repository at this point in the history
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 rero#726.

Co-Authored-by: Bertrand Zuchuat <[email protected]>
  • Loading branch information
Garfield-fr committed Feb 16, 2022
1 parent 7eebf8e commit 29a5f3e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
18 changes: 13 additions & 5 deletions sonar/modules/documents/templates/documents/record.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,26 @@ <h5 class="my-4">{{ _('document_type_' + record.documentType) }}</h5>
</div>
<div class="col">
<h1 class="text-primary">{{ title | nl2br | safe }}</h1>
{% set infoOrgSub = true %}
{%- if view != config.SONAR_APP_DEFAULT_ORGANISATION %}
{% set infoOrgSub = false if record.get('subdivisions', [])|length == 0 else true %}
{%- endif %}
{%- if infoOrgSub %}
<h4 class="m-0">
{%- for organisation in record.get('organisation', []) -%}
<span class="badge badge-secondary text-light mr-1 font-weight-normal">
{{ organisation.name }}
</span>
{%- endfor -%}
{%- if view == config.SONAR_APP_DEFAULT_ORGANISATION %}
{%- for organisation in record.get('organisation', []) -%}
<span class="badge badge-secondary text-light mr-1 font-weight-normal">
{{ organisation.name }}
</span>
{%- endfor -%}
{%- endif %}
{%- for subdivision in record.get('subdivisions', []) -%}
<span class="badge badge-secondary text-light mr-1 font-weight-normal">
{{ subdivision.name | language_value }}
</span>
{%- endfor -%}
</h4>
{%- endif %}

<!-- CONTRIBUTORS-->
{% set contributors = record | contributors %}
Expand Down
4 changes: 3 additions & 1 deletion sonar/modules/documents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)

Expand Down
5 changes: 4 additions & 1 deletion sonar/theme/templates/sonar/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@

<!DOCTYPE html>
<html {% if html_css_classes %} class="{{ html_css_classes|join(' ') }}" {% endif %}
lang="{{ current_i18n.locale.language|safe }}" dir="{{ current_i18n.locale.text_direction }}">
lang="{{ current_i18n.locale.language|safe }}" dir="{{ current_i18n.locale.text_direction }}"
{%- block view %}{%- endblock %}
>


<head>
{% include config.THEME_TRACKINGCODE_TEMPLATE %}
Expand Down
1 change: 1 addition & 0 deletions sonar/theme/templates/sonar/search.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% extends 'sonar/page.html' %}

{%- block view %} data-view="{{ view }}"{%- endblock %}
{%- block body %}
{% if collection %}
{% include 'collections/item.html' %}
Expand Down

0 comments on commit 29a5f3e

Please sign in to comment.