Merge branch 'v12/dev' into contrib
This commit is contained in:
@@ -32,7 +32,7 @@ Umbraco.Sys.ServerVariables = {
|
||||
},
|
||||
umbracoPlugins: {
|
||||
trees: [
|
||||
{ alias: "myTree", packageFolder: "MyPackage", sectionAlias: "myPackageSectionAlias" }
|
||||
{ alias: "myTree", packageFolder: "MyPackage" }
|
||||
]
|
||||
},
|
||||
isDebuggingEnabled: true,
|
||||
|
||||
@@ -616,7 +616,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
if (!treeAlias) {
|
||||
throw "Could not get tree alias for node " + args.node.id;
|
||||
}
|
||||
templateUrl = this.getTreeTemplateUrl(treeAlias, args.action.alias, args.node.section);
|
||||
templateUrl = this.getTreeTemplateUrl(treeAlias, args.action.alias);
|
||||
}
|
||||
|
||||
setMode("dialog");
|
||||
@@ -633,7 +633,6 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
*
|
||||
* @param {string} treeAlias the alias of the tree to look up
|
||||
* @param {string} action the view file name
|
||||
* @param {string} sectionAlias the alias of the current section
|
||||
* @description
|
||||
* creates the templateUrl based on treeAlias and action
|
||||
* by convention we will look into the /views/{treetype}/{action}.html
|
||||
@@ -641,8 +640,8 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
* we will also check for a 'packageName' for the current tree, if it exists then the convention will be:
|
||||
* for example: /App_Plugins/{mypackage}/backoffice/{treetype}/create.html
|
||||
*/
|
||||
getTreeTemplateUrl: function (treeAlias, action, sectionAlias) {
|
||||
var packageTreeFolder = treeService.getTreePackageFolder(treeAlias, sectionAlias);
|
||||
getTreeTemplateUrl: function (treeAlias, action) {
|
||||
var packageTreeFolder = treeService.getTreePackageFolder(treeAlias);
|
||||
if (packageTreeFolder) {
|
||||
return (Umbraco.Sys.ServerVariables.umbracoSettings.appPluginsPath +
|
||||
"/" + packageTreeFolder +
|
||||
|
||||
@@ -166,27 +166,23 @@ function treeService($q, treeResource, iconHelper, notificationsService, eventsS
|
||||
*
|
||||
* @description
|
||||
* Determines if the current tree is a plugin tree and if so returns the package folder it has declared
|
||||
* so we know where to find its views, otherwise it will just return undefined.
|
||||
* so we know where to find it's views, otherwise it will just return undefined.
|
||||
*
|
||||
* @param {String} treeAlias The tree alias to check
|
||||
* @param {String} sectionAlias The current section
|
||||
*/
|
||||
getTreePackageFolder: function (treeAlias, sectionAlias) {
|
||||
getTreePackageFolder: function (treeAlias) {
|
||||
//we determine this based on the server variables
|
||||
if (!Umbraco.Sys.ServerVariables.umbracoPlugins || !Utilities.isArray(Umbraco.Sys.ServerVariables.umbracoPlugins.trees)) {
|
||||
return undefined;
|
||||
}
|
||||
if (Umbraco.Sys.ServerVariables.umbracoPlugins &&
|
||||
Umbraco.Sys.ServerVariables.umbracoPlugins.trees &&
|
||||
Utilities.isArray(Umbraco.Sys.ServerVariables.umbracoPlugins.trees)) {
|
||||
|
||||
let found;
|
||||
if (sectionAlias !== undefined) {
|
||||
found = Umbraco.Sys.ServerVariables.umbracoPlugins.trees.find(item =>
|
||||
invariantEquals(item.alias, treeAlias) && invariantEquals(item.sectionAlias, sectionAlias));
|
||||
} else {
|
||||
found = Umbraco.Sys.ServerVariables.umbracoPlugins.trees.find(item =>
|
||||
invariantEquals(item.alias, treeAlias));
|
||||
}
|
||||
var found = _.find(Umbraco.Sys.ServerVariables.umbracoPlugins.trees, function (item) {
|
||||
return invariantEquals(item.alias, treeAlias);
|
||||
});
|
||||
|
||||
return found ? found.packageFolder : undefined;
|
||||
return found ? found.packageFolder : undefined;
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -872,7 +868,7 @@ function treeService($q, treeResource, iconHelper, notificationsService, eventsS
|
||||
//start
|
||||
var wrappedPromise = doSync();
|
||||
|
||||
//then wrap it
|
||||
//then wrap it
|
||||
wrappedPromise.then(function (args) {
|
||||
deferred.resolve(args);
|
||||
}, function (args) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
window.app.config(function ($routeProvider) {
|
||||
|
||||
|
||||
/**
|
||||
* This determines if the route can continue depending on authentication and initialization requirements
|
||||
* @param {boolean} authRequired If true, it checks if the user is authenticated and will resolve successfully
|
||||
@@ -117,9 +117,9 @@ window.app.config(function ($routeProvider) {
|
||||
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
|
||||
//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) {
|
||||
@@ -175,9 +175,8 @@ window.app.config(function ($routeProvider) {
|
||||
if ($routeParams.section.toLowerCase() === "users" && $routeParams.tree.toLowerCase() === "users" && usersPages.indexOf($routeParams.method.toLowerCase()) === -1) {
|
||||
$scope.templateUrl = "views/users/overview.html";
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.templateUrl = navigationService.getTreeTemplateUrl($routeParams.tree, $routeParams.method, $routeParams.section);
|
||||
}
|
||||
$scope.templateUrl = navigationService.getTreeTemplateUrl($routeParams.tree, $routeParams.method);
|
||||
},
|
||||
reloadOnSearch: false,
|
||||
resolve: canRoute(true)
|
||||
@@ -191,9 +190,8 @@ window.app.config(function ($routeProvider) {
|
||||
if (!$routeParams.tree || !$routeParams.method) {
|
||||
$scope.templateUrl = "views/common/dashboard.html";
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.templateUrl = navigationService.getTreeTemplateUrl($routeParams.tree, $routeParams.method, $routeParams.section);
|
||||
}
|
||||
$scope.templateUrl = navigationService.getTreeTemplateUrl($routeParams.tree, $routeParams.method);
|
||||
},
|
||||
reloadOnSearch: false,
|
||||
reloadOnUrl: false,
|
||||
@@ -201,7 +199,7 @@ window.app.config(function ($routeProvider) {
|
||||
})
|
||||
.otherwise({ redirectTo: '/login' });
|
||||
}).config(function ($locationProvider) {
|
||||
|
||||
|
||||
$locationProvider.html5Mode(false); //turn html5 mode off
|
||||
$locationProvider.hashPrefix('');
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
ng-repeat="subView in subViews track by subView.alias"
|
||||
ng-class="'sub-view-' + subView.name"
|
||||
val-sub-view="subView"
|
||||
ng-if="subView.active"
|
||||
ng-show="subView.active"
|
||||
>
|
||||
<div class="umb-editor-sub-view__content" ng-include="subView.view"></div>
|
||||
</div>
|
||||
|
||||
@@ -298,13 +298,13 @@ describe('tree service tests', function () {
|
||||
|
||||
it('can find a plugin based tree', function () {
|
||||
//we know this exists in the mock umbraco server vars
|
||||
var found = treeService.getTreePackageFolder("myTree", "MyPackageSectionAlias");
|
||||
var found = treeService.getTreePackageFolder("myTree");
|
||||
expect(found).toBe("MyPackage");
|
||||
});
|
||||
|
||||
it('returns undefined for a not found tree', function () {
|
||||
//we know this does not exist in the mock umbraco server vars
|
||||
var found = treeService.getTreePackageFolder("asdfasdf", "fdsafdsa");
|
||||
var found = treeService.getTreePackageFolder("asdfasdf");
|
||||
expect(found).not.toBeDefined();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user