Merge pull request #4535 from MaximilianKrambach/sortings

add default sorting of tags and motion blocks
This commit is contained in:
Emanuel Schütze 2019-03-25 17:16:06 +01:00 committed by GitHub
commit 9df28ae9bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -44,6 +44,7 @@ export class MotionBlockRepositoryService extends BaseAgendaContentObjectReposit
private httpService: HttpService
) {
super(DS, dataSend, mapperService, viewModelStoreService, translate, MotionBlock, [Item]);
this.initSorting();
}
public getAgendaTitle = (motionBlock: Partial<MotionBlock> | Partial<ViewMotionBlock>) => {
@ -125,4 +126,13 @@ export class MotionBlockRepositoryService extends BaseAgendaContentObjectReposit
const restPath = `/rest/motions/motion-block/${motionBlock.id}/follow_recommendations/`;
await this.httpService.post(restPath);
}
/**
* Sets the default sorting (e.g. in dropdowns and for new users) to 'title'
*/
private initSorting(): void {
this.setSortFunction((a: ViewMotionBlock, b: ViewMotionBlock) => {
return this.languageCollator.compare(a.title, b.title);
});
}
}

View File

@ -40,6 +40,7 @@ export class TagRepositoryService extends BaseRepository<ViewTag, Tag> {
translate: TranslateService
) {
super(DS, dataSend, mapperService, viewModelStoreService, translate, Tag);
this.initSorting();
}
public getVerboseName = (plural: boolean = false) => {
@ -51,4 +52,13 @@ export class TagRepositoryService extends BaseRepository<ViewTag, Tag> {
viewTag.getVerboseName = this.getVerboseName;
return viewTag;
}
/**
* Sets the default sorting (e.g. in dropdowns and for new users) to 'name'
*/
private initSorting(): void {
this.setSortFunction((a: ViewTag, b: ViewTag) => {
return this.languageCollator.compare(a.name, b.name);
});
}
}