From 48055f6e73281ff7427643d29e0ad3e0481bed37 Mon Sep 17 00:00:00 2001 From: Anton Strogonoff Date: Thu, 17 Mar 2022 16:04:20 +0700 Subject: [PATCH] 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 --- main/templates/relaton/contributor.html | 37 +++++++++++++------------ 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/main/templates/relaton/contributor.html b/main/templates/relaton/contributor.html index 1e1bf0b1..561f4f35 100644 --- a/main/templates/relaton/contributor.html +++ b/main/templates/relaton/contributor.html @@ -1,20 +1,23 @@ {% load relaton %} -{% if val.role %} - {{ val.role|as_list|join:", " }} -{% 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' %} - - {{ val.organization.abbreviation|default:org_name|default:"N/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' %} - - {% include "relaton/person_name.html" with val=val.person.name %} - - {% 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 %} + {{ val.role|as_list|join:", " }} + {% 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' %} + + {{ val.organization.abbreviation|default:org_name|default:"N/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' %} + + {% include "relaton/person_name.html" with val=val.person.name %} + + {% endwith %} + {% endif %} + {% endif %}