Skip to content

Commit 8970a13

Browse files
committed
fix: improve handling of additional descriptions in detail template
* Handle missing 'type' in description rendering * Add the missing description type when the type is not specified. * closes inveniosoftware#2931
1 parent 4b2debf commit 8970a13

File tree

1 file changed

+7
-4
lines changed
  • invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros

1 file changed

+7
-4
lines changed

Diff for: invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/detail.html

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{#
22
Copyright (C) 2020-2025 CERN.
33
Copyright (C) 2024 Northwestern University.
4+
Copyright (C) 2024 KTH Royal Institute of Technology.
45

56
Invenio RDM Records is free software; you can redistribute it and/or modify
67
it under the terms of the MIT License; see LICENSE file for more details.
@@ -60,12 +61,14 @@
6061
{% macro show_add_descriptions(add_descriptions) %}
6162
{% for add_description in add_descriptions %}
6263
<section id="additional-description-{{ loop.index }}" class="rel-mt-2 rich-input-content"
63-
aria-label="{{ _( add_description.type.title_l10n ) }}">
64-
<h2>{{ add_description.type.title_l10n }} <span
65-
class="text-muted language">{{ '(' + add_description.lang.title_l10n + ')' if add_description.lang }}</span>
64+
aria-label="{{ _( add_description.type.title_l10n ) if add_description.type is defined else 'Missing description!' }}">
65+
<h2>{{ add_description.type.title_l10n if add_description.type is defined else _('Missing Additional description type!') }}
66+
<span class="text-muted language">
67+
{{ '(' + add_description.lang.title_l10n + ')' if add_description.lang is defined else '' }}
68+
</span>
6669
</h2>
6770

68-
{% if add_description.type.id == "notes" %}
71+
{% if add_description.type is defined and add_description.type.id == "notes" %}
6972
<div class="ui message warning">
7073
{{ add_description.description | sanitize_html() | safe }}
7174
</div>

0 commit comments

Comments
 (0)