Merge pull request #4255 from MaximilianKrambach/motionNavigation
sort 'previous/next motion' by identifier in detail view
This commit is contained in:
commit
2ef3b6929f
@ -976,9 +976,21 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the previous and next motion
|
||||
* Sets the previous and next motion. Sorts ascending by identifier, and
|
||||
* then appending motion without identifiers sorted by title
|
||||
*/
|
||||
public setSurroundingMotions(): void {
|
||||
this.allMotions.sort((a, b) => {
|
||||
if (a.identifier && b.identifier) {
|
||||
return a.identifier.localeCompare(b.identifier, this.translate.currentLang);
|
||||
} else if (a.identifier) {
|
||||
return 1;
|
||||
} else if (b.identifier) {
|
||||
return -1;
|
||||
} else {
|
||||
return a.title.localeCompare(b.title, this.translate.currentLang);
|
||||
}
|
||||
});
|
||||
const indexOfCurrent = this.allMotions.findIndex(motion => {
|
||||
return motion === this.motion;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user