Skip to content

Commit

Permalink
fix: improve handling of additional descriptions in detail template
Browse files Browse the repository at this point in the history
* Handle missing 'type' in description rendering
* Add the missing description type when the type is not specified.
* closes #2931
  • Loading branch information
Samk13 committed Dec 5, 2024
1 parent 399ebb4 commit 9c97131
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{#
Copyright (C) 2020-2024 CERN.
Copyright (C) 2024 Northwestern University.
Copyright (C) 2024 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.
Expand Down Expand Up @@ -60,12 +61,14 @@
{% macro show_add_descriptions(add_descriptions) %}
{% for add_description in add_descriptions %}
<section id="additional-description-{{ loop.index }}" class="rel-mt-2 rich-input-content"
aria-label="{{ _( add_description.type.title_l10n ) }}">
<h2>{{ add_description.type.title_l10n }} <span
class="text-muted language">{{ '(' + add_description.lang.title_l10n + ')' if add_description.lang }}</span>
aria-label="{{ _( add_description.type.title_l10n ) if add_description.type is defined else 'Missing description!' }}">
<h2>{{ add_description.type.title_l10n if add_description.type is defined else _('Missing Additional description type!') }}
<span class="text-muted language">
{{ '(' + add_description.lang.title_l10n + ')' if add_description.lang is defined else '' }}
</span>
</h2>

{% if add_description.type.id == "notes" %}
{% if add_description.type is defined and add_description.type.id == "notes" %}
<div class="ui message warning">
{{ add_description.description | sanitize_html() | safe }}
</div>
Expand Down

0 comments on commit 9c97131

Please sign in to comment.