Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User orcid #1930

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/models/search-result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ export default class SearchResultModel extends Model {
return 'unknown';
}

get orcids() {
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() {
return this.resourceMetadata.resourceNature?.[0]['@value'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export enum ResourceTypeFilterValue {
Registrations = 'Registration,RegistrationComponent',
Projects = 'Project,ProjectComponent',
Preprints = 'Preprint',
Users = 'User',
Users = 'Agent',
adlius marked this conversation as resolved.
Show resolved Hide resolved
Files = 'File',
}

Expand Down
40 changes: 27 additions & 13 deletions lib/osf-components/addon/components/search-result-card/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,37 @@
<div local-class='type-label'>
{{this.cardTypeLabel}}
</div>
<Button
{{on 'click' this.toggleSecondaryMetadata}}
>
{{#if this.isOpenSecondaryMetadata}}
<FaIcon
@icon={{'angle-up'}}
/>
{{else}}
<FaIcon
@icon={{'angle-down'}}
/>
{{/if}}
</Button>
{{#if (not-eq @result.resourceType 'user')}}
<Button
{{on 'click' this.toggleSecondaryMetadata}}
>
{{#if this.isOpenSecondaryMetadata}}
<FaIcon
@icon={{'angle-up'}}
/>
{{else}}
<FaIcon
@icon={{'angle-down'}}
/>
{{/if}}
</Button>
{{/if}}
</div>
<h4 local-class='display-name'>
<a href={{@result.absoluteUrl}} target='_blank' rel='noopener noreferrer'> {{@result.displayTitle}} </a>
{{#if @result.orcids}}
{{#each @result.orcids as |item|}}
<a href={{item}}
target='_blank'
rel='noopener noreferrer'
aria-label={{t 'osf-components.search-result-card.link_to_orcid_id'}}
>
<FaIcon @prefix='fab' @icon='orcid' />
</a>
{{/each}}
{{/if}}
</h4>

{{#if @result.affiliatedEntities}}
<div local-class='name-fields'>
<InlineList
Expand Down
1 change: 1 addition & 0 deletions translations/en-us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand Down
Loading