U4-10227 Users section should start in the user tree

This commit is contained in:
Shannon
2017-08-10 17:25:16 +10:00
parent 62e467d860
commit 72495b3eaf
8 changed files with 178 additions and 68 deletions

View File

@@ -154,8 +154,16 @@ function sectionsDirective($timeout, $window, navigationService, treeService, se
}
navigationService.hideSearch();
navigationService.showTree(section.alias);
$location.path("/" + section.alias);
navigationService.showTree(section.alias);
//in some cases the section will have a custom route path specified, if there is one we'll use it
if (section.routePath) {
$location.path(section.routePath);
}
else {
$location.path(section.alias);
}
};
scope.sectionDblClick = function(section){

View File

@@ -98,14 +98,25 @@ app.config(function ($routeProvider) {
resolve: doLogout()
})
.when('/:section', {
templateUrl: function (rp) {
if (rp.section.toLowerCase() === "default" || rp.section.toLowerCase() === "umbraco" || rp.section === "")
{
rp.section = "content";
//This allows us to dynamically change the template for this route since you cannot inject services into the templateUrl method.
template: "<div ng-include='templateUrl'></div>",
//This controller will execute for this route, then we can execute some code in order to set the template Url
controller: function ($scope, $route, $routeParams, $location) {
if ($routeParams.section.toLowerCase() === "default" || $routeParams.section.toLowerCase() === "umbraco" || $routeParams.section === "") {
$routeParams.section = "content";
}
//TODO: Here we could run some extra logic to check if the dashboard we are navigating
//to has any content to show and if not it could redirect to the first tree root path.
//BUT! this would mean that we'd need a server side call to check this data....
//Instead we already have this data in the sections returned from the sectionResource but we
//don't want to cache data in a resource so we'd have to create a sectionService which would rely
//on the userService, then we update the umbsections.directive to use the sectionService and when the
//sectionService requests the sections, it caches the result against the current user. Then we can
//use the sectionService here to do the redirection.
rp.url = "dashboard.aspx?app=" + rp.section;
return 'views/common/dashboard.html';
$routeParams.url = "dashboard.aspx?app=" + $routeParams.section;
$scope.templateUrl = 'views/common/dashboard.html';
},
resolve: canRoute(true)
})
@@ -121,15 +132,11 @@ app.config(function ($routeProvider) {
})
.when('/:section/:tree/:method', {
templateUrl: function (rp) {
//if there is no method registered for this then show the dashboard
if (!rp.method)
return "views/common/dashboard.html";
//NOTE: This current isn't utilized by anything but does open up some cool opportunities for
// us since we'll be able to have specialized views for individual sections which is something
// we've never had before. So could utilize this for a new dashboard model when we get native
// angular dashboards working. Perhaps a normal section dashboard would list out the registered
// dashboards (as tabs if we wanted) and each tab could actually be a route link to one of these views?
return ('views/' + rp.tree + '/' + rp.method + '.html');
},
resolve: canRoute(true)