AW-823 implementcorrect editor navigation

This commit is contained in:
Willem Dantuma 2020-01-08 14:43:24 +01:00
parent ab99f6722c
commit f21648386b

View File

@ -15,18 +15,20 @@ export abstract class AbstractSelectedItemComponent {
} }
handleOnView(item: IItem) { handleOnView(item: IItem) {
var itemType = this.itemTypeService.itemTypes[item.itemType]; if (this.itemTypeService.hasViewer(item)) {
if (itemType) { let viewer = this.itemTypeService.itemTypes[item.itemType];
if (itemType.viewer) { let url = `/viewer/${viewer}/item/${item.code}`;
let url = `/viewer/${itemType.viewer}/item/${item.code}`; this.router.navigate([url]);
this.router.navigate([url]);
}
} }
return false; return false;
} }
handleOnEdit(item: IItem) { handleOnEdit(item: IItem) {
let url = `/editor/property/item/${item.code}`; var editor = "property";
if(this.itemTypeService.hasEditor(item)) {
editor = this.itemTypeService.itemTypes[item.itemType].editor;
}
let url = `/editor/${editor}/item/${item.code}`
this.router.navigate([url]); this.router.navigate([url]);
return false; return false;
} }