diff --git a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/creatibutors.html b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/creatibutors.html index 45c034cac..913dfe277 100644 --- a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/creatibutors.html +++ b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/creatibutors.html @@ -3,6 +3,7 @@ Copyright (C) 2020 Northwestern University. Copyright (C) 2021 Graz University of Technology. Copyright (C) 2021-2022 New York University. + Copyright (C) 2025 KTH Royal Institute of Technology. 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. @@ -15,11 +16,11 @@ {% for scheme, details in config.APP_RDM_IDENTIFIER_SCHEMES_UI.items() %} {% for identifier in creatibutor.person_or_org.identifiers|selectattr("scheme", "equalto", scheme) %} {% set identifier_found.value = True %} - - {{ details.label }} icon {% endfor %} @@ -39,7 +40,7 @@ {% macro show_creatibutors(creatibutors, show_affiliations=False, type="creators", show_role=False) %} - {% for creatibutor in creatibutors %} + {% for creatibutor in creatibutors if creatibutor.person_or_org and creatibutor.person_or_org.name %}
  • {{ affiliation[0] }}. - + {% if affiliation[2] %} {% set scheme, identifier = (affiliation[2].split(':', 1) if ':' in affiliation[2] else ('ror', affiliation[2])) %} {% set scheme_config = config.APP_RDM_IDENTIFIER_SCHEMES_UI.get(scheme) %} - + {% if scheme_config %} {% endif %} {% endif %} - + {{ affiliation[1] }}
  • {% endfor %} - + {% endmacro %} diff --git a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/detail.html b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/detail.html index 63fce52aa..7fba802f8 100644 --- a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/detail.html +++ b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/detail.html @@ -1,6 +1,7 @@ {# Copyright (C) 2020-2025 CERN. Copyright (C) 2024 Northwestern University. + Copyright (C) 2024-2025 KTH Royal Institute of Technology. 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. @@ -59,18 +60,25 @@ {% macro show_add_descriptions(add_descriptions) %} {% for add_description in add_descriptions %} -
    -

    {{ add_description.type.title_l10n }} {{ '(' + add_description.lang.title_l10n + ')' if add_description.lang }} + {% set desc_type_defined = add_description.type is defined %} + {% set desc_text = add_description.description|default('') %} +
    +

    + {{ add_description.type.title_l10n if desc_type_defined else _('Missing description type!') }} + + {{ '(' ~ add_description.lang.title_l10n ~ ')' if add_description.lang is defined else '' }} +

    - - {% if add_description.type.id == "notes" %} + {% if desc_type_defined and add_description.type.id == "notes" %}
    - {{ add_description.description | sanitize_html() | safe }} + {{ desc_text | sanitize_html() | safe }}
    {% else %} - {{ add_description.description | sanitize_html() | safe }} + {{ desc_text | sanitize_html() | safe }} {% endif %}
    {% endfor %} @@ -79,10 +87,11 @@

    {{ add_description.type.title_l10n }} {{ date.type.title_l10n }} + {% set date_type_title = date.type.title_l10n if (date.type is defined and date.type.title_l10n is defined) else _('Unknown date type') %} +
    {{ date_type_title }}
    -
    {{ date.date }}
    -
    {{ date.description }}
    +
    {{ date.date|default('') }}
    +
    {{ date.description|default('') }}
    {% endfor %} {% endmacro %} @@ -103,7 +112,7 @@

    {{ add_description.type.title_l10n }} {{ add_description.type.title_l10n }} {% for reference in references %} - {% set reference_string = reference.reference %} - {% if 'identifier' in reference %} - {% if 'scheme' in reference %} + {% set reference_string = reference.reference|default('') %} + {% if reference.identifier is defined and reference.identifier %} + {% if reference.scheme is defined and reference.scheme %} {% set reference_scheme = reference.scheme | get_scheme_label %} - {% set reference_string = reference_string + ' ( ' + reference_scheme + - ' - ' + reference.identifier + ' )' %} + {% set reference_string = reference_string ~ ' (' ~ reference_scheme ~ ' - ' ~ reference.identifier ~ ')' %} {% else %} - {% set reference_string = reference_string + ' ( ' + reference.identifier + - ' )' %} + {% set reference_string = reference_string ~ ' (' ~ reference.identifier ~ ')' %} {% endif %} {% endif %}
  • {{ reference_string | urlize }}
  • @@ -150,20 +157,23 @@

    {{ add_description.type.title_l10n }} - {% if identifier.resource_type is defined %} + {% if identifier.resource_type is defined and identifier.resource_type.title_l10n is defined %} {{ identifier.resource_type.title_l10n }}: {% endif %} - {% set url = identifier.identifier|pid_url %} + {% set ident_val = identifier.identifier|default('') %} + {% set url = ident_val|pid_url %} {% if url %} - {{ identifier.identifier }} + {{ ident_val }} {% else %} - {{ identifier.identifier }} + {{ ident_val }} {% endif %} - {{ ' (' + identifier.scheme | get_scheme_label + ')' }} + {% if identifier.scheme is defined and identifier.scheme %} + {{ ' (' ~ (identifier.scheme|get_scheme_label) ~ ')' }} + {% endif %} {% endfor %} {% endmacro %} @@ -171,7 +181,7 @@

    {{ add_description.type.title_l10n }} - {%- for group in related_identifiers | groupby('relation_type.title_l10n') %} + {%- for group in (related_identifiers|selectattr("relation_type","defined")|list) | groupby('relation_type.title_l10n') %}
    {{ group.grouper }}
    {{ _identifiers_for_group(group.list) }} {%- endfor %}