private string _getNavigationObject(NavigationGroupDTO dto) { string children = ""; foreach (var p in dto.Pages) { string param = p.RouteParameters ?? ""; string action = p.ActionName == null ? "ResourceActions." + p.PrivilegeType : "\"" + p.ActionName + "\""; RouteTsModel route = new RouteTsModel { Name = p.PageIdentifier, Action = action, Navigate = "true", Resource = p.ResourceName, Apps = p.Apps == null ? "null" : "[" + p.Apps + "]", Url = _fileNameService.ApplyConvension(p.Url, AppParts.Route) }; var s = "\n\t\t\t\t\t{{ name: \"{0}\", navigate: {1}, resource:\"{2}\", action: {3}, apps: {4} , url: \"{5}\"}},"; children += string.Format(s, route.Name, route.Navigate, route.Resource, route.Action, route.Apps, route.Url); } return(string.Format("{{\n\t\t\t\tname: \"{0}\" ,\n\t\t\t\tchildren: [{1}]\n\t\t\t}}", dto.Name, children)); }
private string _childRoute(PageDTO p) { string routeTemplate = _molds.RouteMold; string param = p.Page.RouteParameters ?? ""; string action = p.ActionName == null ? "ResourceActions." + p.Page.PrivilegeType ?? "view" : "\"" + p.ActionName + "\""; string component = p.Page.ViewPath.GetAfterLast("/"); RouteTsModel route = new RouteTsModel { Path = _fileNameService.ApplyConvension(component, AppParts.Route) + param, Component = component, Name = p.PageIdentifier, Action = action, Navigate = "false", Resource = p.ResourceName, Apps = p.Page.Apps == null ? "null" : "[" + p.Page.Apps + "]" }; return(_writer.FillStringParameters(routeTemplate, route)); }