|
11 | 11 | {% macro creatibutor_icon(creatibutor) %} |
12 | 12 | {% set identifier_found = namespace(value=False) %} |
13 | 13 |
|
14 | | - {% for scheme, identifier in creatibutor.person_or_org.identifiers|groupby("scheme") %} |
15 | | - {%- if scheme == "orcid" %} |
16 | | - {% set identifier_found.value = True %} |
17 | | - <a class="no-text-decoration" href="{{ identifier[0]['identifier']|pid_url('orcid') }}" aria-label="{{ creatibutor.person_or_org.name }}'s ORCID {{ _('profile') }}" title="{{ creatibutor.person_or_org.name }}'s ORCID {{ _('profile') }}"> |
18 | | - <img class="ml-5 inline-id-icon" src="{{ url_for('static', filename='images/orcid.svg') }}" alt="ORCID icon"/> |
19 | | - </a> |
20 | | - {%- elif scheme == "ror" %} |
21 | | - {% set identifier_found.value = True %} |
22 | | - <a href="{{ identifier[0]['identifier']|pid_url('ror') }}" aria-label="{{ creatibutor.person_or_org.name }}'s ROR {{ _('profile') }}" title="{{ creatibutor.person_or_org.name }}'s ROR {{ _('profile') }}"> |
23 | | - <img class="ml-5 inline-id-icon" src="{{ url_for('static', filename='images/ror-icon.svg') }}" alt="ROR icon"/> |
24 | | - </a> |
25 | | - {%- elif scheme == "gnd" %} |
26 | | - {% set identifier_found.value = True %} |
27 | | - <a href="{{ identifier[0]['identifier']|pid_url('gnd') }}" aria-label="{{ creatibutor.person_or_org.name }}'s GND {{ _('profile') }}" title="{{ creatibutor.person_or_org.name }}'s GND {{ _('profile') }}"> |
28 | | - <img class="ml-5 inline-id-icon" src="{{ url_for('static', filename='images/gnd-icon.svg') }}" alt="GND icon"/> |
29 | | - </a> |
30 | | - {%- endif %} |
31 | | - {% endfor %} |
| 14 | + {% if config.APP_RDM_IDENTIFIER_SCHEMES_UI %} |
| 15 | + {% for scheme, details in config.APP_RDM_IDENTIFIER_SCHEMES_UI.items() %} |
| 16 | + {% for identifier in creatibutor.person_or_org.identifiers|selectattr("scheme", "equalto", scheme) %} |
| 17 | + {% set identifier_found.value = True %} |
| 18 | + <a href="{{ identifier.identifier|pid_url(scheme) }}" |
| 19 | + aria-label="{{ creatibutor.person_or_org.name }}'s {{ details.label }} {{ _('profile') }}" |
| 20 | + title="{{ creatibutor.person_or_org.name }}'s {{ details.label }} {{ _('profile') }}"> |
| 21 | + <img class="ml-5 inline-id-icon" |
| 22 | + src="{{ url_for('static', filename=details.icon) }}" |
| 23 | + alt="{{ details.label }} icon"/> |
| 24 | + </a> |
| 25 | + {% endfor %} |
| 26 | + {% endfor %} |
| 27 | + {% endif %} |
32 | 28 |
|
33 | | - {# if no identifiers: distinguish btw people and organizations #} |
34 | | - {%- if not identifier_found.value and creatibutor.person_or_org.type == 'organizational'%} |
35 | | - <i class="group icon"></i> |
36 | | - {%- endif %} |
| 29 | + {# Fallback for missing identifiers #} |
| 30 | + {% if not identifier_found.value %} |
| 31 | + {% if creatibutor.person_or_org.type == 'organizational' %} |
| 32 | + <i class="group icon"></i> |
| 33 | + {% else %} |
| 34 | + <i class="user icon"></i> |
| 35 | + {% endif %} |
| 36 | + {% endif %} |
37 | 37 | {% endmacro %} |
38 | 38 |
|
39 | 39 |
|
| 40 | + |
40 | 41 | {% macro show_creatibutors(creatibutors, show_affiliations=False, type="creators", show_role=False) %} |
41 | 42 | {% for creatibutor in creatibutors %} |
42 | 43 | <li class="creatibutor-wrap separated"> |
|
81 | 82 |
|
82 | 83 | <section class="ui sixteen wide column content" id="{{ group }}-affiliations" aria-label="{{ _('Affiliations for') }} {{ group }}"> |
83 | 84 | <ul> |
84 | | - {% for affiliation in affiliations %} |
85 | | - <li> |
86 | | - {{ affiliation[0] }}. |
87 | | - |
88 | | - {% if affiliation[2] %} |
| 85 | + {% for affiliation in affiliations %} |
| 86 | + <li> |
| 87 | + {{ affiliation[0] }}. |
| 88 | + |
| 89 | + {% if affiliation[2] %} |
| 90 | + {% set scheme, identifier = (affiliation[2].split(':', 1) if ':' in affiliation[2] else ('ror', affiliation[2])) %} |
| 91 | + {% set scheme_config = config.APP_RDM_IDENTIFIER_SCHEMES_UI.get(scheme) %} |
| 92 | + |
| 93 | + {% if scheme_config %} |
89 | 94 | <a class="no-text-decoration" |
90 | | - href="https://ror.org/{{affiliation[2]}}" |
91 | | - aria-label="{{ affiliation[1] }}'s ROR {{ _('profile') }}" |
92 | | - title="{{ affiliation[1] }}'s ROR {{ _('profile') }}" |
| 95 | + href="{{ scheme_config.url_prefix + identifier }}" |
| 96 | + aria-label="{{ affiliation[1] }}'s {{ scheme_config.label }} {{ _('profile') }}" |
| 97 | + title="{{ affiliation[1] }}'s {{ scheme_config.label }} {{ _('profile') }}" |
93 | 98 | > |
94 | | - <img class="ml-5 inline-id-icon" src="{{ url_for('static', filename='images/ror-icon.svg') }}" alt="ROR icon"/> |
| 99 | + <img class="ml-5 inline-id-icon" |
| 100 | + src="{{ url_for('static', filename=scheme_config.icon) }}" |
| 101 | + alt="{{ scheme_config.label }} icon" |
| 102 | + /> |
95 | 103 | </a> |
96 | | - {%- endif %} |
97 | | - {{affiliation[1]}} |
98 | | - </li> |
| 104 | + {% endif %} |
| 105 | + {% endif %} |
| 106 | + |
| 107 | + {{ affiliation[1] }} |
| 108 | + </li> |
99 | 109 | {% endfor %} |
| 110 | + |
100 | 111 | </ul> |
101 | 112 | </section> |
102 | 113 | {% endmacro %} |
0 commit comments