Update Umbraco to 7.12.2
This commit is contained in:
+53
-17
@@ -31,6 +31,12 @@ app.config(function ($routeProvider) {
|
||||
userService.getCurrentUser({ broadcastEvent: broadcast }).then(function (user) {
|
||||
//is auth, check if we allow or reject
|
||||
if (isRequired) {
|
||||
|
||||
//This checks the current section and will force a redirect to 'content' as the default
|
||||
if ($route.current.params.section.toLowerCase() === "default" || $route.current.params.section.toLowerCase() === "umbraco" || $route.current.params.section === "") {
|
||||
$route.current.params.section = "content";
|
||||
}
|
||||
|
||||
// U4-5430, Benjamin Howarth
|
||||
// We need to change the current route params if the user only has access to a single section
|
||||
// To do this we need to grab the current user's allowed sections, then reject the promise with the correct path.
|
||||
@@ -98,14 +104,29 @@ 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";
|
||||
}
|
||||
|
||||
rp.url = "dashboard.aspx?app=" + rp.section;
|
||||
return 'views/common/dashboard.html';
|
||||
|
||||
//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, sectionService) {
|
||||
|
||||
//We are going to check the currently loaded sections for the user and if the section we are navigating
|
||||
//to has a custom route path we'll use that
|
||||
sectionService.getSectionsForUser().then(function(sections) {
|
||||
//find the one we're requesting
|
||||
var found = _.find(sections, function(s) {
|
||||
return s.alias === $routeParams.section;
|
||||
})
|
||||
if (found && found.routePath) {
|
||||
//there's a custom route path so redirect
|
||||
$location.path(found.routePath);
|
||||
}
|
||||
else {
|
||||
//there's no custom route path so continue as normal
|
||||
$routeParams.url = "dashboard.aspx?app=" + $routeParams.section;
|
||||
$scope.templateUrl = 'views/common/dashboard.html';
|
||||
}
|
||||
});
|
||||
},
|
||||
resolve: canRoute(true)
|
||||
})
|
||||
@@ -120,17 +141,32 @@ app.config(function ($routeProvider) {
|
||||
resolve: canRoute(true)
|
||||
})
|
||||
.when('/:section/:tree/:method', {
|
||||
templateUrl: function (rp) {
|
||||
if (!rp.method)
|
||||
return "views/common/dashboard.html";
|
||||
//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 replace the template dynamnically based on the current tree.
|
||||
controller: function ($scope, $route, $routeParams, treeService) {
|
||||
|
||||
//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?
|
||||
if (!$routeParams.method) {
|
||||
$scope.templateUrl = "views/common/dashboard.html";
|
||||
}
|
||||
|
||||
return ('views/' + rp.tree + '/' + rp.method + '.html');
|
||||
// Here we need to figure out if this route is for a package tree and if so then we need
|
||||
// to change it's convention view path to:
|
||||
// /App_Plugins/{mypackage}/backoffice/{treetype}/{method}.html
|
||||
|
||||
// otherwise if it is a core tree we use the core paths:
|
||||
// views/{treetype}/{method}.html
|
||||
|
||||
var packageTreeFolder = treeService.getTreePackageFolder($routeParams.tree);
|
||||
|
||||
if (packageTreeFolder) {
|
||||
$scope.templateUrl = (Umbraco.Sys.ServerVariables.umbracoSettings.appPluginsPath +
|
||||
"/" + packageTreeFolder +
|
||||
"/backoffice/" + $routeParams.tree + "/" + $routeParams.method + ".html");
|
||||
}
|
||||
else {
|
||||
$scope.templateUrl = ('views/' + $routeParams.tree + '/' + $routeParams.method + '.html');
|
||||
}
|
||||
},
|
||||
resolve: canRoute(true)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user