diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/umbtreeitem.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/umbtreeitem.directive.js index 47206c4b07..6326b43674 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/umbtreeitem.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/umbtreeitem.directive.js @@ -38,42 +38,14 @@ angular.module("umbraco.directives") * @param n {object} The tree node object associated with the click */ scope.select = function(e,n,ev){ - - //here we need to check for some legacy tree code - if (n.jsClickCallback && n.jsClickCallback !== "") { - //this is a legacy tree node! - var jsPrefix = "javascript:"; - var js; - if (n.jsClickCallback.startsWith(jsPrefix)) { - js = n.jsClickCallback.substr(jsPrefix.length); - } - else { - js = n.jsClickCallback; - } - try { - var func = eval(js); - //this is normally not necessary since the eval above should execute the method and will return nothing. - if (func != null && (typeof func === "function")) { - func.call(); - } - } - catch(ex) { - $log.error("Error evaluating js callback from legacy tree node: " + ex); - } - } - else { - //not legacy, lets just set the route value - $location.path(n.view); - } - scope.$emit("treeNodeSelect", { element: e, node: n, event: ev }); }; - scope.load = function (arrow, node) { + scope.load = function (arrow, node) { if (node.expanded){ node.expanded = false; - node.children = []; + node.children = []; }else { @@ -86,9 +58,9 @@ angular.module("umbraco.directives") node.children = data; node.expanded = true; - }, function (reason) { + }, function (reason) { // $(arrow).parent().remove(loader); - node.loading = false; + node.loading = false; notificationsService.error(reason); //alert(reason); diff --git a/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js b/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js index 5aebead137..4044138d1b 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js @@ -1,8 +1,20 @@ angular.module('umbraco.services') .factory('dialogService', ['$rootScope', '$compile', '$http', '$timeout', '$q', '$templateCache', - function($rootScope, $compile, $http, $timeout, $q, $templateCache) { + function($rootScope, $compile, $http, $timeout, $q, $templateCache) { - function _open(options){ + var _dialogs = []; + $rootScope.$on("closeDialogs", function () { + for (var i = 0; i < _dialogs.length; i++) { + var dialog = _dialogs[i]; + dialog.modal("hide"); + dialog.remove(); + $("#" + dialog.attr("id")).remove(); + _dialogs.splice(i,1); + } + }); + + + function _open(options){ if(!options){ options = {}; } @@ -21,17 +33,14 @@ angular.module('umbraco.services') .addClass(animationClass) .addClass(modalClass); - $rootScope.$on("closeDialogs", function () { - $modal.modal("hide"); - - $modal.remove(); - $("#" + $modal.attr("id")).remove(); - }); - + + _dialogs.push($modal); if(options.iframe) { var html = $(""); + $modal.html(html); + $('body').append($modal); if(width){ diff --git a/src/Umbraco.Web.UI.Client/src/index.html b/src/Umbraco.Web.UI.Client/src/index.html index cd60633009..bac166cb41 100644 --- a/src/Umbraco.Web.UI.Client/src/index.html +++ b/src/Umbraco.Web.UI.Client/src/index.html @@ -19,8 +19,10 @@
+ + diff --git a/src/Umbraco.Web.UI.Client/src/packages/property editors/mntp/mntp.js b/src/Umbraco.Web.UI.Client/src/packages/property editors/mntp/mntp.js index 65395bcb2f..7f8681adba 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/property editors/mntp/mntp.js +++ b/src/Umbraco.Web.UI.Client/src/packages/property editors/mntp/mntp.js @@ -3,11 +3,10 @@ angular.module('umbraco') .controller("uComponents.Editors.MNTPController", function($scope, dialogService){ - - alert("node!"); $scope.openContentPicker =function(value){ var d = dialogService.contentPicker({scope: $scope, callback: populate}); + var s = d; }; function populate(data){ diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/contentpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/contentpicker.controller.js index 47922ab7f7..9cba113871 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/contentpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/contentpicker.controller.js @@ -3,7 +3,9 @@ angular.module("umbraco").controller("Umbraco.Dialogs.ContentPickerController", function ($scope) { $scope.$on("treeNodeSelect", function(event, args){ - args.event.preventDefault(); + args.event.preventDefault(); + args.event.stopPropagation(); + $(args.event.target.parentElement).find("i.umb-tree-icon").attr("class", "icon umb-tree-icon sprTree icon-check blue"); $scope.select(args.node); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/common/main.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/main.controller.js index c105fffa4b..8bad5e8faa 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/main.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/main.controller.js @@ -25,7 +25,11 @@ function MainController($scope, $routeParams, $rootScope, $timeout, notification }; $scope.closeDialogs = function (event) { - $rootScope.$emit("closeDialogs"); + + //only close dialogs if non-lin and non-buttons are clicked + if(event.target.nodeName != "A" && event.target.nodeName != "BUTTON"){ + $rootScope.$emit("closeDialogs"); + } if (navigationService.ui.stickyNavigation && $(event.target).parents(".umb-modalcolumn").size() == 0) { navigationService.hideNavigation(); diff --git a/src/Umbraco.Web.UI.Client/src/views/common/navigation.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/navigation.controller.js index 23d5bbc0eb..4ddede30d9 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/navigation.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/navigation.controller.js @@ -9,7 +9,7 @@ * * @param navigationService {navigationService} A reference to the navigationService */ -function NavigationController($scope, navigationService, sectionResource) { +function NavigationController($scope, $location, navigationService, sectionResource) { //load navigation service handlers $scope.changeSection = navigationService.changeSection; $scope.showTree = navigationService.showTree; @@ -32,12 +32,49 @@ function NavigationController($scope, navigationService, sectionResource) { }); //events + + //this reacts to the options item in the tree $scope.$on("treeOptionsClick", function (ev, args) { $scope.currentNode = args.node; args.scope = $scope; navigationService.showMenu(ev, args); }); + + //this reacts to tree items themselves being clicked + //the tree directive should not contain any handling, simply just bubble events + $scope.$on("treeNodeSelect", function (ev, args) { + + var n = args.node; + + //here we need to check for some legacy tree code + if (n.jsClickCallback && n.jsClickCallback !== "") { + //this is a legacy tree node! + var jsPrefix = "javascript:"; + var js; + if (n.jsClickCallback.startsWith(jsPrefix)) { + js = n.jsClickCallback.substr(jsPrefix.length); + } + else { + js = n.jsClickCallback; + } + try { + var func = eval(js); + //this is normally not necessary since the eval above should execute the method and will return nothing. + if (func != null && (typeof func === "function")) { + func.call(); + } + } + catch(ex) { + $log.error("Error evaluating js callback from legacy tree node: " + ex); + } + } + else { + //not legacy, lets just set the route value + $location.path(n.view); + } + }); + $scope.openDialog = function (currentNode, action, currentSection) { navigationService.showDialog({ scope: $scope, diff --git a/src/Umbraco.Web.UI/App_Plugins/SimpleEditor/PropertyEditors/js/simpleeditor.js b/src/Umbraco.Web.UI/App_Plugins/SimpleEditor/PropertyEditors/js/simpleeditor.js index bbc0c1147e..37630a55da 100644 --- a/src/Umbraco.Web.UI/App_Plugins/SimpleEditor/PropertyEditors/js/simpleeditor.js +++ b/src/Umbraco.Web.UI/App_Plugins/SimpleEditor/PropertyEditors/js/simpleeditor.js @@ -1,8 +1,6 @@ (function () { - angular.module("umbraco").controller("Umbraco.Editors.SimpleEditorController", function ($rootScope, $scope, notificationsService, dialogService) { - alert("wat"); + }); - })(); \ No newline at end of file diff --git a/src/Umbraco.Web.UI/App_Plugins/property editors/mntp/mntp.html b/src/Umbraco.Web.UI/App_Plugins/property editors/mntp/mntp.html new file mode 100644 index 0000000000..21fc1837a0 --- /dev/null +++ b/src/Umbraco.Web.UI/App_Plugins/property editors/mntp/mntp.html @@ -0,0 +1,18 @@ +
+ + +

+
\ No newline at end of file diff --git a/src/Umbraco.Web.UI/App_Plugins/property editors/mntp/mntp.js b/src/Umbraco.Web.UI/App_Plugins/property editors/mntp/mntp.js new file mode 100644 index 0000000000..7f8681adba --- /dev/null +++ b/src/Umbraco.Web.UI/App_Plugins/property editors/mntp/mntp.js @@ -0,0 +1,15 @@ +//this controller simply tells the dialogs service to open a mediaPicker window +//with a specified callback, this callback will receive an object with a selection on it +angular.module('umbraco') +.controller("uComponents.Editors.MNTPController", + function($scope, dialogService){ + + $scope.openContentPicker =function(value){ + var d = dialogService.contentPicker({scope: $scope, callback: populate}); + var s = d; + }; + + function populate(data){ + $scope.model.value = data.selection; + } +}); \ No newline at end of file diff --git a/src/Umbraco.Web.UI/App_Plugins/property editors/package.manifest b/src/Umbraco.Web.UI/App_Plugins/property editors/package.manifest new file mode 100644 index 0000000000..6fd9ba44bf --- /dev/null +++ b/src/Umbraco.Web.UI/App_Plugins/property editors/package.manifest @@ -0,0 +1,15 @@ +{ + propertyEditors: [ + { + id: "7e062c13-7c41-4ad9-b389-41d88aeef87c", + name: "Multinode treepicker", + editor: { + view: "~/App_Plugins/property editors/mntp/mntp.html" + } + } + ] + , + javascript: [ + '~/App_Plugins/property editors/mntp/mntp.js' + ] +} \ No newline at end of file