Fixes initial part with legacy trees and legacy actions - now a modal window can launch - but now we need to get the legacy umb client manager js tree stuff hooked in.

This commit is contained in:
Shannon
2013-10-14 18:47:34 +11:00
parent df25edfaf6
commit d9c42e2aca
7 changed files with 124 additions and 28 deletions

View File

@@ -204,7 +204,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Application");
//get our angular navigation service
var injector = getRootInjector();
var dialogService = injector.get("dialogService");
var dialogService = injector.get("dialogService");
var self = this;
@@ -219,12 +219,14 @@ Umbraco.Sys.registerNamespace("Umbraco.Application");
//add the callback to the jquery data for the modal so we can call it on close to support the legacy way dialogs worked.
dialog.element.data("modalCb", onCloseCallback);
//add the close triggers
for (var i = 0; i < closeTriggers.length; i++) {
var e = dialog.find(closeTriggers[i]);
if (e.length > 0) {
e.click(function() {
self.closeModalWindow();
});
if (angular.isArray(closeTriggers)) {
for (var i = 0; i < closeTriggers.length; i++) {
var e = dialog.find(closeTriggers[i]);
if (e.length > 0) {
e.click(function () {
self.closeModalWindow();
});
}
}
}

View File

@@ -15,25 +15,31 @@ angular.module("umbraco.directives")
//we'll try to get the jsAction from the injector
var menuAction = action.metaData["jsAction"].split('.');
if (menuAction.length !== 2) {
throw "The jsAction assigned to a menu action must have two parts delimited by a '.' ";
}
var service = $injector.get(menuAction[0]);
if (!service) {
throw "The angular service " + menuAction[0] + " could not be found";
}
//if it is not two parts long then this most likely means that it's a legacy action
var js = action.metaData["jsAction"];
//there's not really a different way to acheive this except for eval
eval(js);
var method = service[menuAction[1]];
if (!method) {
throw "The method " + menuAction[1] + " on the angular service " + menuAction[0] + " could not be found";
}
else {
var service = $injector.get(menuAction[0]);
if (!service) {
throw "The angular service " + menuAction[0] + " could not be found";
}
method.apply(this, [{
treeNode: currentNode,
action: action,
section: currentSection
}]);
var method = service[menuAction[1]];
if (!method) {
throw "The method " + menuAction[1] + " on the angular service " + menuAction[0] + " could not be found";
}
method.apply(this, [{
treeNode: currentNode,
action: action,
section: currentSection
}]);
}
}
else {
//by default we launch the dialog