Merge pull request #4663 from GabrielInTheWorld/sorting
Fixes the listing of motions in a category
This commit is contained in:
commit
a3bf5481ed
@ -122,7 +122,7 @@
|
|||||||
<div *ngIf="motionsInCategory(category).length > 0">
|
<div *ngIf="motionsInCategory(category).length > 0">
|
||||||
<span translate>Motions</span>:
|
<span translate>Motions</span>:
|
||||||
<div>
|
<div>
|
||||||
<ul *ngFor="let motion of motionsInCategory(category)">
|
<ul *ngFor="let motion of getSortedMotionListInCategory(category)">
|
||||||
<li class="ellipsis-overflow">{{ motion.getListTitle() }}</li>
|
<li class="ellipsis-overflow">{{ motion.getListTitle() }}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -190,6 +190,18 @@ export class CategoryListComponent extends BaseViewComponent implements OnInit {
|
|||||||
return this.motionRepo.getSortedViewModelList().filter(m => m.category_id === category.id);
|
return this.motionRepo.getSortedViewModelList().filter(m => m.category_id === category.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to get a sorted list of all motions in a specific category.
|
||||||
|
* Sorting by `category_weight`.
|
||||||
|
*
|
||||||
|
* @param category the target category in where the motions are.
|
||||||
|
*
|
||||||
|
* @returns all motions in the given category sorted by their category_weight.
|
||||||
|
*/
|
||||||
|
public getSortedMotionListInCategory(category: Category): ViewMotion[] {
|
||||||
|
return this.motionsInCategory(category).sort((a, b) => a.category_weight - b.category_weight);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the correct URL for a detail sort view
|
* Fetch the correct URL for a detail sort view
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user