Skip to content

Commit 48055f6

Browse files
committed
fix: hide creator if name is missing in source
Otherwise it uselessly shows up as N/A. Works around data source issue https://github.com/ietf-ribose/relaton-data-misc/issues/3
1 parent ed35930 commit 48055f6

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

Diff for: main/templates/relaton/contributor.html

+20-17
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
{% load relaton %}
2-
{% if val.role %}
3-
<small class="text-xs opacity-50">{{ val.role|as_list|join:", " }}</small>
4-
{% endif %}
52

6-
{% if val.organization %}
7-
{% with org_name=val.organization.name|as_list|first link=val|substruct_search_link:'{"contributor": [%s]};as_list=yes;only=organization.abbreviation,organization.name' %}
8-
<a class="link" href="{{ link }}">
9-
{{ val.organization.abbreviation|default:org_name|default:"N/A" }}
10-
</a>
11-
{% endwith %}
12-
{% elif val.person.name %}
13-
{% with link=val|substruct_search_link:'{"contributor": [%s]};as_list=yes;only=person.name.completename.content,person.name.surname.content,person.name.forename[*].content' %}
14-
<a class="link" href="{{ link }}">
15-
{% include "relaton/person_name.html" with val=val.person.name %}
16-
</a>
17-
{% endwith %}
18-
{% else %}
19-
{% include "deflist/entry_recursivedict.html" with key_sr_only=True key=val.role|default:"contributor"|as_list|join:", " val=c %}
3+
{% if val.organization.abbreviation or org_name or val.person.name %}
4+
5+
{% if val.role %}
6+
<small class="text-xs opacity-50">{{ val.role|as_list|join:", " }}</small>
7+
{% endif %}
8+
9+
{% if val.organization.abbreviation or org_name %}
10+
{% with org_name=val.organization.name|as_list|first link=val|substruct_search_link:'{"contributor": [%s]};as_list=yes;only=organization.abbreviation,organization.name' %}
11+
<a class="link" href="{{ link }}">
12+
{{ val.organization.abbreviation|default:org_name|default:"N/A" }}
13+
</a>
14+
{% endwith %}
15+
{% elif val.person.name %}
16+
{% with link=val|substruct_search_link:'{"contributor": [%s]};as_list=yes;only=person.name.completename.content,person.name.surname.content,person.name.forename[*].content' %}
17+
<a class="link" href="{{ link }}">
18+
{% include "relaton/person_name.html" with val=val.person.name %}
19+
</a>
20+
{% endwith %}
21+
{% endif %}
22+
2023
{% endif %}

0 commit comments

Comments
 (0)