Skip to content

Commit

Permalink
Merge pull request #214 from ror-community/dev
Browse files Browse the repository at this point in the history
Merge dev to staging: Lang codes and JSON link fixes
  • Loading branch information
lizkrznarich committed Apr 15, 2024
2 parents 6c28a48 + 255e3cc commit 4a29ab8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
23 changes: 13 additions & 10 deletions app/components/v2/organization-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default Component.extend({
lastModifiedDate: null,
otherNames: null,
organizationTypes: null,
configService: service('config-service'),


// Convert label array into a dictionary with relationship type as key
Expand All @@ -45,12 +46,14 @@ export default Component.extend({
return result;
}, {});

if (groupedNames.label) {
groupedNames.label.forEach((label) => {
if (label.lang && !label.value.includes(`(${label.lang})`)) {
label.value = `${label.value} (${label.lang})`;
}
});
for (let key in groupedNames) {
if (groupedNames[key]) {
groupedNames[key].forEach((item) => {
if (item.lang && !item.value.includes(`(${item.lang})`)) {
item.value = `${item.value} (${item.lang})`;
}
})
}
}

const values = Object.values(groupedNames).flat().map(item => item.value).join(', ');
Expand Down Expand Up @@ -80,7 +83,7 @@ export default Component.extend({
this.set('grid', externalId.preferred);
}
break;

case 'isni':
if (externalId.preferred) {
let displayIsni = externalId.preferred;
Expand All @@ -94,23 +97,23 @@ export default Component.extend({
this.set('link_isni', linkIsni);
}
break;

case 'fundref':
if (externalId.preferred) {
this.set('fundref', externalId.preferred);
} else {
this.set('fundref', externalId.all[0]);
}
break;

case 'wikidata':
if (externalId.preferred) {
this.set('wikidata', externalId.preferred);
} else {
this.set('wikidata', externalId.all[0]);
}
break;

default:
break;
}
Expand Down
7 changes: 7 additions & 0 deletions app/services/config-service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Service from '@ember/service';
import config from '../config/environment';

export default Service.extend({
API_URL_V1: config.API_URL_V1,
API_URL_V2: config.API_URL_V2
});
2 changes: 1 addition & 1 deletion app/templates/components/v2/organization-item.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
{{#link-to "organizations.show" model.id class="btn btn-sm btn-round"}}View details{{/link-to}}
{{/if}}
{{#if (not isSearch)}}
<p class="mt-3 mb-0"><i>Some record data is not displayed in this view. <a target="_blank" rel="noopener" href="https://api.ror.org/v2/organizations/{{model.id}}">See JSON view for full record data</a></i></p>
<p class="mt-3 mb-0"><i>Some record data is not displayed in this view. <a target="_blank" rel="noopener" href="{{configService.API_URL_V2}}/organizations/{{model.id}}">See JSON view for full record data</a></i></p>
<p class="mt-3 mb-0">
<i>
{{#if lastModifiedDate}}
Expand Down

0 comments on commit 4a29ab8

Please sign in to comment.