add default sorting of tags and motion blocks

This commit is contained in:
Maximilian Krambach 2019-03-25 13:43:47 +01:00
parent 279b8b1d25
commit 4efede0396
2 changed files with 20 additions and 0 deletions

View File

@ -44,6 +44,7 @@ export class MotionBlockRepositoryService extends BaseAgendaContentObjectReposit
private httpService: HttpService private httpService: HttpService
) { ) {
super(DS, dataSend, mapperService, viewModelStoreService, translate, MotionBlock, [Item]); super(DS, dataSend, mapperService, viewModelStoreService, translate, MotionBlock, [Item]);
this.initSorting();
} }
public getAgendaTitle = (motionBlock: Partial<MotionBlock> | Partial<ViewMotionBlock>) => { 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/`; const restPath = `/rest/motions/motion-block/${motionBlock.id}/follow_recommendations/`;
await this.httpService.post(restPath); 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 translate: TranslateService
) { ) {
super(DS, dataSend, mapperService, viewModelStoreService, translate, Tag); super(DS, dataSend, mapperService, viewModelStoreService, translate, Tag);
this.initSorting();
} }
public getVerboseName = (plural: boolean = false) => { public getVerboseName = (plural: boolean = false) => {
@ -51,4 +52,13 @@ export class TagRepositoryService extends BaseRepository<ViewTag, Tag> {
viewTag.getVerboseName = this.getVerboseName; viewTag.getVerboseName = this.getVerboseName;
return viewTag; 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);
});
}
} }