public ClientRouteAlterationBuilder View(Action<ClientViewDescriptor> action) {
     Configure(descriptor => {
         var viewDescriptor = new ClientViewDescriptor();
         action(viewDescriptor);
         descriptor.Views.Add(viewDescriptor);
     });
     return this;
 }
 public ClientRouteAlterationBuilder View(Action<ClientViewDescriptor> action) {
     Configure(descriptor => {
         var viewDescriptor = new ClientViewDescriptor();
         action(viewDescriptor);
         var existedView = descriptor.Views.FirstOrDefault(
             view => string.Equals(view.Name,viewDescriptor.Name,StringComparison.OrdinalIgnoreCase));
         if (existedView == null) {
             descriptor.Views.Add(viewDescriptor);
         }
         else {
             action(existedView);
         }
     });
     return this;
 }
Example #3
0
 public ClientRouteAlterationBuilder View(Action <ClientViewDescriptor> action)
 {
     Configure(descriptor => {
         var viewDescriptor = new ClientViewDescriptor();
         action(viewDescriptor);
         var existedView = descriptor.Views.FirstOrDefault(
             view => string.Equals(view.Name, viewDescriptor.Name, StringComparison.OrdinalIgnoreCase));
         if (existedView == null)
         {
             descriptor.Views.Add(viewDescriptor);
         }
         else
         {
             action(existedView);
         }
     });
     return(this);
 }
Example #4
0
        public override void Discover(ClientRouteTableBuilder builder) {
            var navigationView = new ClientViewDescriptor() {
                Name = "menulist",
                TemplateProvider = @"['$http', '$stateParams', function ($http, $stateParams) {
                        var url = '" + ModuleBasePath + @"ViewTemplate/MenuList';
                        return $http.get(url).then(function (response) { return response.data; });
                    }]",
                Controller = "NavigationCtrl"
            };
            navigationView.AddDependencies(ToAbsoluteScriptUrl, "controllers/navigationcontroller");

            builder.Describe("Root")
                .Configure(descriptor => {
                    descriptor.Url = "/";
                    descriptor.Views.Add(navigationView);
                });

            builder.Describe("Navigation")
                .Configure(descriptor => {
                    descriptor.Url = "/{NavigationId:[0-9]+}";
                    descriptor.Views.Add(navigationView);
                });

            builder.Describe("List")
                .Configure(descriptor => {
                    descriptor.Url = "/{NavigationId:[0-9]+}/{Module:[a-zA-Z]+}";
                    descriptor.Views.Add(navigationView);
                })
                .View(view => {
                    view.TemplateProvider = @"['$http', '$stateParams', function ($http, $stateParams) {
                        var url = '" + BasePath + @"' + $stateParams.Module + '/ViewTemplate/List/' + $stateParams.Module;
                        return $http.get(url).then(function (response) { return response.data; });
                    }]";
                    view.Controller = "GeneralListCtrl";
                    view.AddDependencies(ToAbsoluteScriptUrl, new[] { "controllers/listcontroller" });
                });

            builder.Describe("Create")
                .Configure(descriptor => {
                    descriptor.Url = "/{NavigationId:[0-9]+}/{Module:[a-zA-Z]+}/Create";
                    descriptor.Views.Add(navigationView);
                })
                .View(view => {
                    view.TemplateProvider = @"['$http', '$stateParams', function ($http, $stateParams) {
                        var url = '" + BasePath + @"' + $stateParams.Module + '/ViewTemplate/Create/' + $stateParams.Module;
                        return $http.get(url).then(function (response) { return response.data; });
                    }]";
                    view.Controller = "GeneralDetailCtrl";
                    view.AddDependencies(ToAbsoluteScriptUrl, new[] { "controllers/detailcontroller" });
                });

            builder.Describe("Detail")
                .Configure(descriptor => {
                    descriptor.Url = "/{NavigationId:[0-9]+}/{Module:[a-zA-Z]+}/{Id:[0-9a-zA-Z]+}";
                    descriptor.Views.Add(navigationView);
                })
                .View(view => {
                    view.TemplateProvider = @"['$http', '$stateParams', function ($http, $stateParams) {
                        var url = '" + BasePath + @"'+ $stateParams.Module + '/ViewTemplate/Edit/' + $stateParams.Id;
                        return $http.get(url).then(function (response) { return response.data; });
                    }]";
                    view.Controller = "GeneralDetailCtrl";
                    view.AddDependencies(ToAbsoluteScriptUrl, new[] { "controllers/detailcontroller" });
                });

            builder.Describe("View")
                .Configure(descriptor => {
                    descriptor.Url = "/{NavigationId:[0-9]+}/{Module:[a-zA-Z]+}/View/{Id:[0-9a-zA-Z]+}";
                    descriptor.Views.Add(navigationView);
                })
                .View(view => {
                    view.TemplateProvider = @"['$http', '$stateParams', function ($http, $stateParams) {
                        var url = '" + BasePath + @"' + $stateParams.Module + '/ViewTemplate/View/' + $stateParams.Id;
                        return $http.get(url).then(function (response) { return response.data; });
                    }]";
                    view.Controller = "GeneralViewCtrl";
                    view.AddDependencies(ToAbsoluteScriptUrl, "controllers/viewcontroller");
                });
        }