{# Copyright (C) 2020-2021 CERN. Copyright (C) 2020-2021 Northwestern University. Copyright (C) 2021 New York University. Invenio RDM Records is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. #} {%- from "invenio_app_rdm/records/macros/detail.html" import show_section_custom_fields, show_references, show_add_titles, show_alternate_identifiers, show_related_identifiers, show_funding, show_dates %} {% set hasContent = namespace(value=false) %} {% set hasContent.value = record_ui["ui"]["additional_titles"] or metadata.identifiers or record_ui["ui"]["related_identifiers"] or metadata.funding or record_ui["ui"]["dates"] or metadata.references %} {# Check if custom field has values if no other content #} {% if record_ui["ui"]["custom_fields"] and not hasContent.value %} {% for section_cfg in custom_fields_ui %} {% for field_cfg in section_cfg.fields %} {% if record_ui["custom_fields"].get(field_cfg.field) %} {% set hasContent.value = true %} {% endif %} {% endfor %} {% endfor %} {% endif %} {% set rights = record_ui["ui"].get('rights') %} {% set funding = record_ui["ui"].get('funding') %} {% if hasContent.value %}

{{ _('Additional details') }}

{% if record_ui["ui"]["additional_titles"] %} {% if record_ui["ui"]["additional_titles"]|length > 5 %}

{{ _('Additional titles') }}

{{ show_add_titles(record_ui["ui"]["additional_titles"]) }}
{% else %}

{{ _('Additional titles') }}

{{ show_add_titles(record_ui["ui"]["additional_titles"]) }}
{% endif %}
{% endif %} {% if metadata.identifiers %} {% if metadata.identifiers|length > 5 %}

{{ _('Identifiers') }}

{{ show_alternate_identifiers(metadata.identifiers) }}
{% else %}

{{ _('Identifiers') }}

{{ show_alternate_identifiers(metadata.identifiers) }}
{% endif %}
{% endif %} {% if record_ui["ui"]["related_identifiers"] %} {% if record_ui["ui"]["related_identifiers"]|length > 5 %}

{% else %}

{{ _('Related works') }}

{{ show_related_identifiers(record_ui["ui"]["related_identifiers"]) }}
{% endif %}
{% endif %} {% if funding %} {% if funding|length > 5 %}

{{ _('Funding') }}

{{ show_funding(funding) }}
{% else %}

{{ _('Funding') }}

{{ show_funding(funding) }}
{% endif %}
{% endif %} {% if record_ui["ui"]["dates"] %} {% if record_ui["ui"]["dates"]|length > 5 %}

{{ _('Dates') }}

{{ show_dates(record_ui["ui"]["dates"]) }}
{% else %}

{{ _('Dates') }}

{{ show_dates(record_ui["ui"]["dates"]) }}
{% endif %}
{% endif %} {% if record_ui["custom_fields"] %} {%- for section_cfg in custom_fields_ui %} {% set section_has_fields = namespace(value=false) %} {% set section_format = section_cfg.section | replace(" ", "-") %} {# Show the section if at least one of its fields is in record #} {% for field_cfg in section_cfg.fields %} {% if record_ui["custom_fields"].get(field_cfg.field) %} {% set section_has_fields.value = true %} {% endif %} {% endfor %} {% if section_has_fields.value %}

{{ section_cfg.section }}

{% set section_format = section_cfg.section | replace(" ", "-") %}
{{ show_section_custom_fields(record_ui["ui"]["custom_fields"], section_cfg.fields) }}
{% endif %} {%- endfor %} {% endif %} {% if metadata.references %} {% if metadata.references|length > 5 %}

{{ _('References') }}

{{ show_references(metadata.references) }}
{% else %}

{{ _('References') }}

{{ show_references(metadata.references) }}
{% endif %}
{% endif %} {% endif %} {% block extras %}{% endblock %}