Skip to content

Commit

Permalink
Fix sort options for works (#2155)
Browse files Browse the repository at this point in the history
* Fix sort options for works

* Fix source default directional arrow and sorting options for Funding and Works
  • Loading branch information
amontenegro authored Feb 19, 2024
1 parent ef4981c commit d9fbcb4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,19 @@ export class AffiliationStacksGroupsComponent implements OnInit {
@Output()
expandedContentChange: EventEmitter<MainPanelsState> = new EventEmitter()
professionalActivitiesTogglz = false
sortTypes: SortOrderType[] = ['title', 'start', 'end']
sortTypes: SortOrderType[] = ['title', 'start', 'end', 'source']
professionalActivitiesSortTypes: SortOrderType[] = [
'title',
'type',
'start',
'end',
'source'
]
educationAndQualificationSortTypes: SortOrderType[] = [
'title',
'start',
'end',
'source'
]
constructor(
private _record: RecordService,
Expand All @@ -76,17 +78,7 @@ export class AffiliationStacksGroupsComponent implements OnInit {
this._togglz
.getStateOf('PROFESSIONAL_ACTIVITIES')
.pipe(take(1))
.subscribe((value) => (this.professionalActivitiesTogglz = value))
this._togglz
.getStateOf('SOURCE_SORTING')
.pipe(take(1))
.subscribe((sourceSortingTogglz: boolean) => {
if (sourceSortingTogglz) {
this.sortTypes.push('source')
this.professionalActivitiesSortTypes.push('source')
this.educationAndQualificationSortTypes.push('source')
}
})
.subscribe((value) => (this.professionalActivitiesTogglz = value))
this.$loading = this._recordAffiliationService.$loading
this._record
.getRecord({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
[(expandedContent)]="expandedContent['FUNDING']"
(expandedContentChange)="expandedContentChange.emit(expandedContent)"
[sortTypes]="sortTypes"
[sortType]="'date'"
[sortType]="'end'"
(sort)="sortEvent($event)"
>
<ng-container *ngIf="fundings.length > 0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class FundingStacksGroupsComponent implements OnInit {
ngOrcidFunding = $localize`:@@shared.funding:Funding`
countryCodes: { key: string; value: string }[]
loading = true
sortTypes: SortOrderType[] = ['title', 'start', 'end']
sortTypes: SortOrderType[] = ['title', 'start', 'end', 'source']

constructor(
private _userSession: UserService,
Expand All @@ -52,14 +52,6 @@ export class FundingStacksGroupsComponent implements OnInit {
) {}

ngOnInit(): void {
this._togglz
.getStateOf('SOURCE_SORTING')
.pipe(take(1))
.subscribe((sourceSortingTogglz: boolean) => {
if (sourceSortingTogglz) {
this.sortTypes.push('source')
}
})
this.getRecord()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class WorkStackGroupComponent implements OnInit {
platform: PlatformInfo
selectedWorks: string[] = []
selectAll: false
sortTypes: SortOrderType[] = ['title', 'start', 'end']
sortTypes: SortOrderType[] = ['title', 'date', 'type','source']

@ViewChildren('selectAllCheckbox') selectAllCheckbox: MatCheckbox
@ViewChildren('appWorkStacks') appWorkStacks: QueryList<WorkStackComponent>
Expand All @@ -150,15 +150,7 @@ export class WorkStackGroupComponent implements OnInit {
private _togglz: TogglzService
) {}

ngOnInit(): void {
this._togglz
.getStateOf('SOURCE_SORTING')
.pipe(take(1))
.subscribe((sourceSortingTogglz: boolean) => {
if (sourceSortingTogglz) {
this.sortTypes.push('source')
}
})
ngOnInit(): void {
this.$loading = this._works.$loading
this._record
.getRecord({ publicRecordId: this.isPublicRecord })
Expand Down

0 comments on commit d9fbcb4

Please sign in to comment.