Merge pull request #4535 from MaximilianKrambach/sortings
add default sorting of tags and motion blocks
This commit is contained in:
commit
9df28ae9bc
@ -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);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user