diff --git a/src/app/cdk/panel/sort-label.pipe.ts b/src/app/cdk/panel/sort-label.pipe.ts index 3d1616a990..0cd292bc0c 100644 --- a/src/app/cdk/panel/sort-label.pipe.ts +++ b/src/app/cdk/panel/sort-label.pipe.ts @@ -12,6 +12,7 @@ export class SortLabelPipe implements PipeTransform { date: $localize`:@@share.sortDate:Date`, type: $localize`:@@share.sortType:Type`, order: $localize`:@@share.sortOrderv2:Publication/Grant title`, + source: $localize`:@@shared.source:Source`, } transform(value: SortOrderType): string { return this.SortOrderTypeLabel[value] diff --git a/src/app/cdk/top-bar-verification-email/top-bar-verification-email.component.ts b/src/app/cdk/top-bar-verification-email/top-bar-verification-email.component.ts index 972dd4a394..78b5f9b568 100644 --- a/src/app/cdk/top-bar-verification-email/top-bar-verification-email.component.ts +++ b/src/app/cdk/top-bar-verification-email/top-bar-verification-email.component.ts @@ -1,7 +1,6 @@ import { Component, Input, OnDestroy, OnInit } from '@angular/core' import { first, takeUntil } from 'rxjs/operators' import { Subject } from 'rxjs' -import { MatDialog } from '@angular/material/dialog' import { RecordEmailsService } from 'src/app/core/record-emails/record-emails.service' import { RecordService } from 'src/app/core/record/record.service' import { PlatformInfoService } from '../platform-info' diff --git a/src/app/core/record-affiliations-sort/record-affiliations-sort.service.ts b/src/app/core/record-affiliations-sort/record-affiliations-sort.service.ts index 985a6ce1eb..0b8cab6437 100644 --- a/src/app/core/record-affiliations-sort/record-affiliations-sort.service.ts +++ b/src/app/core/record-affiliations-sort/record-affiliations-sort.service.ts @@ -4,7 +4,6 @@ import { AffiliationUIGroup, AffiliationGroup, AffiliationType, - AffiliationTypeValue, } from 'src/app/types/record-affiliation.endpoint' import { UserRecordOptions } from 'src/app/types/record.local' @@ -21,7 +20,8 @@ export class AffiliationsSortService { value, userRecordContext?.sortAsc, userRecordContext?.sort, - type + type, + userRecordContext?.publicRecordId || userRecordContext?.privateRecordId ) } @@ -29,7 +29,8 @@ export class AffiliationsSortService { affiliationGroups: AffiliationUIGroup[], ascending = false, by = 'end', - type = null + type = null, + orcid: string ): AffiliationUIGroup[] { if (type === 'PROFESSIONAL_ACTIVITIES' && by === 'type') { const affiliations = affiliationGroups.filter( @@ -85,6 +86,15 @@ export class AffiliationsSortService { affiliationGroup.reverse() } } + + if (by === 'source') { + affiliationGroup.sort((a, b) => { + return Number(AffiliationsSortService.isSelfAsserted(a, orcid)) - Number(AffiliationsSortService.isSelfAsserted(b, orcid)) + }) + if (!ascending) { + affiliationGroup.reverse() + } + } } }) return affiliationGroups @@ -192,4 +202,8 @@ export class AffiliationsSortService { return this.sortByDate(a, b, false, 'end') }) } + + private static isSelfAsserted(affiliationGroup: AffiliationGroup, orcid: string): boolean { + return affiliationGroup.defaultAffiliation.source === orcid + } } diff --git a/src/app/record/components/affiliation-stacks-groups/affiliation-stacks-groups.component.html b/src/app/record/components/affiliation-stacks-groups/affiliation-stacks-groups.component.html index 6949574cae..167ff9144d 100644 --- a/src/app/record/components/affiliation-stacks-groups/affiliation-stacks-groups.component.html +++ b/src/app/record/components/affiliation-stacks-groups/affiliation-stacks-groups.component.html @@ -21,6 +21,7 @@ [(expandedContent)]="expandedContent['EMPLOYMENT']" (expandedContentChange)="expandedContentChange.emit(expandedContent)" [isPublicRecord]="isPublicRecord" + [sortTypes]="['title', 'start', 'end', 'source']" [sortType]="'end'" (sort)="sortEvent($event, 'EMPLOYMENT')" id="cy-affiliation-employment" @@ -85,6 +86,7 @@ [(expandedContent)]="expandedContent['EDUCATION_AND_QUALIFICATION']" (expandedContentChange)="expandedContentChange.emit(expandedContent)" [isPublicRecord]="isPublicRecord" + [sortTypes]="['title', 'start', 'end', 'source']" [sortType]="'end'" (sort)="sortEvent($event, 'EDUCATION_AND_QUALIFICATION')" id="cy-affiliation-education-and-qualification" @@ -287,7 +289,7 @@ [(expandedContent)]="expandedContent['PROFESSIONAL_ACTIVITIES']" (expandedContentChange)="expandedContentChange.emit(expandedContent)" [isPublicRecord]="isPublicRecord" - [sortTypes]="['title', 'type', 'start', 'end']" + [sortTypes]="['title', 'type', 'start', 'end', 'source']" (sort)="sortEvent($event, 'PROFESSIONAL_ACTIVITIES')" [professionalActivitiesTogglz]="professionalActivitiesTogglz" id="cy-affiliation-professional-activities" diff --git a/src/app/record/components/funding-stacks-groups/funding-stacks-groups.component.html b/src/app/record/components/funding-stacks-groups/funding-stacks-groups.component.html index 136b315dff..bccb353be2 100644 --- a/src/app/record/components/funding-stacks-groups/funding-stacks-groups.component.html +++ b/src/app/record/components/funding-stacks-groups/funding-stacks-groups.component.html @@ -15,7 +15,7 @@ [isPublicRecord]="isPublicRecord" [(expandedContent)]="expandedContent['FUNDING']" (expandedContentChange)="expandedContentChange.emit(expandedContent)" - [sortTypes]="['date', 'title', 'type']" + [sortTypes]="['date', 'title', 'type', 'source']" [sortType]="'date'" (sort)="sortEvent($event)" > diff --git a/src/app/record/components/work-stack-group/work-stack-group.component.html b/src/app/record/components/work-stack-group/work-stack-group.component.html index 43e6ef2ecf..a729b151c7 100644 --- a/src/app/record/components/work-stack-group/work-stack-group.component.html +++ b/src/app/record/components/work-stack-group/work-stack-group.component.html @@ -15,7 +15,7 @@ [isPublicRecord]="isPublicRecord" [(expandedContent)]="expandedContent['WORK']" (expandedContentChange)="expandedContentChange.emit(expandedContent)" - [sortTypes]="['date', 'title', 'type']" + [sortTypes]="['date', 'title', 'type', 'source']" [sortType]="'date'" [addMenuOptions]="addMenuOptions" (sort)="sortEvent($event)" diff --git a/src/app/shared/pipes/app-panels-sort-by-aria-label/app-panels-sort-by-aria-label.pipe.ts b/src/app/shared/pipes/app-panels-sort-by-aria-label/app-panels-sort-by-aria-label.pipe.ts index 9c2380fb50..df51061b03 100644 --- a/src/app/shared/pipes/app-panels-sort-by-aria-label/app-panels-sort-by-aria-label.pipe.ts +++ b/src/app/shared/pipes/app-panels-sort-by-aria-label/app-panels-sort-by-aria-label.pipe.ts @@ -17,6 +17,8 @@ export class AppPanelsSortByAriaLabelPipe implements PipeTransform { return getDateLabelByType(type) case 'type': return getTypeLabelByType(type) + case 'source': + return getSourceLabelByType(type) case 'order': return $localize`:@@shared.peerReviewsSortOrderv2:Sort peer review by Publication/Grant title` } @@ -104,3 +106,19 @@ const getDateLabelByType = (type: string): string => { return $localize`:@@shared.researchSortDate:Sort research resources by date` } } + +const getSourceLabelByType = (type: string): string => { + switch (type) { + case 'employment': + return $localize`:@@shared.employmentSortSource:Sort employment by source` + case 'education': + case 'qualification': + return $localize`:@@shared.educationSortSource:Sort education and qualifications by source` + case 'professional-activities': + return $localize`:@@shared.professionalActivitiesSortSource:Sort professional activities by source` + case 'funding': + return $localize`:@@shared.fundingSortSource:Sort funding by source` + case 'works': + return $localize`:@@shared.worksSortSource:Sort works by source` + } +} diff --git a/src/app/types/sort.ts b/src/app/types/sort.ts index 7d4716ee73..157e52b828 100644 --- a/src/app/types/sort.ts +++ b/src/app/types/sort.ts @@ -7,6 +7,7 @@ export type SortOrderType = | 'date' | 'type' | 'order' + | 'source' export interface SortData { direction: SortOrderDirection diff --git a/src/environments/environment.local.ts b/src/environments/environment.local.ts index 5d737d50ed..19b844ebb1 100644 --- a/src/environments/environment.local.ts +++ b/src/environments/environment.local.ts @@ -8,7 +8,7 @@ export const environment = { BASE_URL: '', INFO_SITE: 'https://info.orcid.org/', GOOGLE_ANALYTICS_TESTING_MODE: true, - GOOGLE_TAG_MANAGER: 'GTM-0000000', + GOOGLE_TAG_MANAGER: 'GTM-M9Z7DHS', GOOGLE_RECAPTCHA: '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI', HELP_HERO_ID: 'oYFQMrzFHA', ZENDESK: null, diff --git a/src/locale/properties/shared/shared.en.properties b/src/locale/properties/shared/shared.en.properties index 344d537289..7d5e47b421 100644 --- a/src/locale/properties/shared/shared.en.properties +++ b/src/locale/properties/shared/shared.en.properties @@ -628,3 +628,8 @@ shared.researchSortDate=Sort research resources by date shared.today=Today share.more=more shared.orcidHelpCenter=ORCID Help Center +shared.employmentSortSource=Sort employment by source +shared.educationSortSource=Sort education and qualifications by source +shared.fundingSortSource=Sort funding by source +shared.professionalActivitiesSortSource=Sort professional activities by source +shared.worksSortSource=Sort works by source