Merge pull request #5035 from GabrielInTheWorld/sortingReferMotions

Quick sorting the reference of motions by their identifier
This commit is contained in:
GabrielInTheWorld 2019-09-23 10:25:43 +02:00 committed by GitHub
commit a688bd0ffe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -29,7 +29,7 @@
<!-- recommendation referencing motions --> <!-- recommendation referencing motions -->
<h2 *ngIf="data.data.recommendation_referencing_motions"> <h2 *ngIf="data.data.recommendation_referencing_motions">
<span translate>Referring motions</span>: <span translate>Referring motions</span>:
<span *ngFor="let titleInformation of data.data.recommendation_referencing_motions; let last = last"> <span *ngFor="let titleInformation of referencingMotions; let last = last">
{{ getIdentifierOrTitle(titleInformation) }}<span *ngIf="!last">,</span> {{ getIdentifierOrTitle(titleInformation) }}<span *ngIf="!last">,</span>
</span> </span>
</h2> </h2>

View File

@ -54,6 +54,11 @@ export class MotionSlideComponent extends BaseMotionSlideComponent<MotionSlideDa
*/ */
public allChangingObjects: ViewUnifiedChange[]; public allChangingObjects: ViewUnifiedChange[];
/**
* Reference to all referencing motions to store sorted by `identifier`.
*/
public referencingMotions = [];
private _data: SlideData<MotionSlideData>; private _data: SlideData<MotionSlideData>;
@Input() @Input()
@ -66,6 +71,12 @@ export class MotionSlideComponent extends BaseMotionSlideComponent<MotionSlideDa
this.textDivStyles.width = value.data.show_meta_box ? 'calc(100% - 250px)' : '100%'; this.textDivStyles.width = value.data.show_meta_box ? 'calc(100% - 250px)' : '100%';
if (value.data.recommendation_referencing_motions) {
this.referencingMotions = value.data.recommendation_referencing_motions.sort((a, b) =>
a.identifier.localeCompare(b.identifier)
);
}
this.recalcUnifiedChanges(); this.recalcUnifiedChanges();
} }