From 0352773cd1009817b471342b803b24c3a13b7df4 Mon Sep 17 00:00:00 2001 From: Yuhuai Liu Date: Tue, 15 Aug 2023 12:40:15 -0400 Subject: [PATCH 1/3] add user orcid --- app/models/search-result.ts | 7 ++++ .../addon/components/search-page/component.ts | 2 +- .../search-result-card/template.hbs | 34 ++++++++++++------- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/app/models/search-result.ts b/app/models/search-result.ts index 4b7b9287c5..39962df229 100644 --- a/app/models/search-result.ts +++ b/app/models/search-result.ts @@ -192,6 +192,13 @@ export default class SearchResultModel extends Model { return 'unknown'; } + get orcids() { + const orcids = this.resourceMetadata.identifier.filter( + (item: any) => item['@value'].includes('http://orcid.org/'), + ); + return orcids.map( (item: any) => item['@value']); + } + get resourceNature() { return this.resourceMetadata.resourceNature?.[0]['@value']; } diff --git a/lib/osf-components/addon/components/search-page/component.ts b/lib/osf-components/addon/components/search-page/component.ts index 70dae23f48..6586c2c5fc 100644 --- a/lib/osf-components/addon/components/search-page/component.ts +++ b/lib/osf-components/addon/components/search-page/component.ts @@ -25,7 +25,7 @@ export enum ResourceTypeFilterValue { Registrations = 'Registration,RegistrationComponent', Projects = 'Project,ProjectComponent', Preprints = 'Preprint', - Users = 'User', + Users = 'Agent', Files = 'File', } diff --git a/lib/osf-components/addon/components/search-result-card/template.hbs b/lib/osf-components/addon/components/search-result-card/template.hbs index 5d4e3f3167..eb3333848f 100644 --- a/lib/osf-components/addon/components/search-result-card/template.hbs +++ b/lib/osf-components/addon/components/search-result-card/template.hbs @@ -4,23 +4,31 @@
{{this.cardTypeLabel}}
- + {{#if (not-eq @result.resourceType 'user')}} + + {{/if}}

{{@result.displayTitle}} + {{#if @result.orcids}} + {{#each @result.orcids as |item|}} + + {{/each}} + {{/if}}

+ {{#if @result.affiliatedEntities}}
Date: Tue, 15 Aug 2023 13:02:17 -0400 Subject: [PATCH 2/3] fix tests --- app/models/search-result.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/models/search-result.ts b/app/models/search-result.ts index 39962df229..904c1f0fab 100644 --- a/app/models/search-result.ts +++ b/app/models/search-result.ts @@ -193,10 +193,13 @@ export default class SearchResultModel extends Model { } get orcids() { - const orcids = this.resourceMetadata.identifier.filter( - (item: any) => item['@value'].includes('http://orcid.org/'), - ); - return orcids.map( (item: any) => item['@value']); + if (this.resourceMetadata.identifier) { + const orcids = this.resourceMetadata.identifier.filter( + (item: any) => item['@value'].includes('http://orcid.org/'), + ); + return orcids.map( (item: any) => item['@value']); + } + return null; } get resourceNature() { From 31b2cbaaf98b73d56f12398eb4a41a2ff448ece5 Mon Sep 17 00:00:00 2001 From: Yuhuai Liu Date: Wed, 16 Aug 2023 00:43:41 -0400 Subject: [PATCH 3/3] add aria label for link --- .../addon/components/search-result-card/template.hbs | 8 +++++++- translations/en-us.yml | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/osf-components/addon/components/search-result-card/template.hbs b/lib/osf-components/addon/components/search-result-card/template.hbs index eb3333848f..0ce0715a06 100644 --- a/lib/osf-components/addon/components/search-result-card/template.hbs +++ b/lib/osf-components/addon/components/search-result-card/template.hbs @@ -24,7 +24,13 @@ {{@result.displayTitle}} {{#if @result.orcids}} {{#each @result.orcids as |item|}} - + + + {{/each}} {{/if}} diff --git a/translations/en-us.yml b/translations/en-us.yml index 0aaf464b0f..345c7fb65c 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -1879,6 +1879,7 @@ osf-components: user: User project_component: Project component registration_component: Registration component + link_to_orcid_id: Link to orcid id resources-list: add_instructions: 'Link a DOI from a repository to your registration by clicking the green “+” button.' add_instructions_adhere: 'Contributors affirmed to adhere to the criteria for each badge.'