Skip to content

Commit

Permalink
fix: hide creator if name is missing in source
Browse files Browse the repository at this point in the history
Otherwise it uselessly shows up as N/A.

Works around data source issue https://github.com/ietf-ribose/relaton-data-misc/issues/3
  • Loading branch information
strogonoff committed Mar 17, 2022
1 parent ed35930 commit 48055f6
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions main/templates/relaton/contributor.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
{% load relaton %}
{% if val.role %}
<small class="text-xs opacity-50">{{ val.role|as_list|join:", " }}</small>
{% endif %}

{% if val.organization %}
{% with org_name=val.organization.name|as_list|first link=val|substruct_search_link:'{"contributor": [%s]};as_list=yes;only=organization.abbreviation,organization.name' %}
<a class="link" href="{{ link }}">
{{ val.organization.abbreviation|default:org_name|default:"N/A" }}
</a>
{% endwith %}
{% elif val.person.name %}
{% with link=val|substruct_search_link:'{"contributor": [%s]};as_list=yes;only=person.name.completename.content,person.name.surname.content,person.name.forename[*].content' %}
<a class="link" href="{{ link }}">
{% include "relaton/person_name.html" with val=val.person.name %}
</a>
{% endwith %}
{% else %}
{% include "deflist/entry_recursivedict.html" with key_sr_only=True key=val.role|default:"contributor"|as_list|join:", " val=c %}
{% if val.organization.abbreviation or org_name or val.person.name %}

{% if val.role %}
<small class="text-xs opacity-50">{{ val.role|as_list|join:", " }}</small>
{% endif %}

{% if val.organization.abbreviation or org_name %}
{% with org_name=val.organization.name|as_list|first link=val|substruct_search_link:'{"contributor": [%s]};as_list=yes;only=organization.abbreviation,organization.name' %}
<a class="link" href="{{ link }}">
{{ val.organization.abbreviation|default:org_name|default:"N/A" }}
</a>
{% endwith %}
{% elif val.person.name %}
{% with link=val|substruct_search_link:'{"contributor": [%s]};as_list=yes;only=person.name.completename.content,person.name.surname.content,person.name.forename[*].content' %}
<a class="link" href="{{ link }}">
{% include "relaton/person_name.html" with val=val.person.name %}
</a>
{% endwith %}
{% endif %}

{% endif %}

0 comments on commit 48055f6

Please sign in to comment.