Quick sorting the reference of motions by their identifier

This commit is contained in:
GabrielMeyer 2019-09-18 18:26:20 +02:00 committed by Emanuel Schütze
parent ee50191da6
commit 0cac6b1e8d
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();
} }