diff --git a/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js b/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js index 0131ff3fda..1933a22727 100644 --- a/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js +++ b/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js @@ -173,6 +173,23 @@ Umbraco.Sys.registerNamespace("Umbraco.Application"); navService.loadLegacyIFrame(strLocation); }, + + /** This is used to launch an angular based modal window instead of the legacy window */ + openAngularModalWindow: function (options, onCloseCallback) { + + //get our angular navigation service + var injector = getRootInjector(); + var dialogService = injector.get("dialogService"); + + var dialog = dialogService.open(options); + + ////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); + + //this._modal.push(dialog); + //return dialog; + }, + openModalWindow: function(url, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback) { //need to create the modal on the top window if the top window has a client manager, if not, create it on the current window 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 21dea1da17..b0186354d2 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 @@ -58,7 +58,10 @@ angular.module('umbraco.services') template: "views/common/notfound.html", callback: undefined, closeCallback: undefined, - element: undefined + element: undefined, + //this allows us to pass in data to the dialog if required which can be used to configure the dialog + //and re-use it for different purposes. It will set on to the $scope.dialogData if it is defined. + dialogData: undefined }; var dialog = angular.extend(defaults, options); @@ -68,14 +71,15 @@ angular.module('umbraco.services') //Modal dom obj and unique id dialog.element = $('
'); var id = dialog.template.replace('.html', '').replace('.aspx', '').replace(/[\/|\.|:\&\?\=]/g, "-") + '-' + scope.$id; - - if(options.inline){ - dialog.animation = ""; - dialog.modalClass = ""; - }else{ - dialog.element.addClass("modal"); - dialog.element.addClass("hide"); - } + + if (options.inline) { + dialog.animation = ""; + dialog.modalClass = ""; + } + else { + dialog.element.addClass("modal"); + dialog.element.addClass("hide"); + } //set the id and add classes dialog.element .attr('id', id) @@ -132,8 +136,6 @@ angular.module('umbraco.services') dialog.element.modal('show'); } - //store the callback in the modal jquery data - //dialog.element.data("modalCb", dialog.callback); dialog.scope = scope; return dialog; } @@ -152,10 +154,7 @@ angular.module('umbraco.services') //append to body or other container element dialog.container.append(dialog.element); - - //store the callback in the modal jquery data - dialog.element.data("modalCb", dialog.callback); - + // Compile modal content $timeout(function() { $compile(dialog.element)(scope); @@ -164,7 +163,7 @@ angular.module('umbraco.services') scope.dialogOptions = dialog; //Scope to handle data from the modal form - scope.dialogData = {}; + scope.dialogData = dialog.dialogData ? dialog.dialogData : {}; scope.dialogData.selection = []; // Provide scope display functions diff --git a/src/Umbraco.Web.UI.Client/src/views/settings/template/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js similarity index 96% rename from src/Umbraco.Web.UI.Client/src/views/settings/template/edit.controller.js rename to src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js index fdad44e4b1..bea498ef64 100644 --- a/src/Umbraco.Web.UI.Client/src/views/settings/template/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js @@ -1,13 +1,13 @@ -/** - * @ngdoc controller - * @name Umbraco.Editors.Settings.Template.EditController - * @function - * - * @description - * The controller for editing templates - */ -function TemplateEditController($scope, navigationService) { - $scope.template = "

Hej

"; -} - -angular.module("umbraco").controller("Umbraco.Editors.Settings.Template.EditController", TemplateEditController); +/** + * @ngdoc controller + * @name Umbraco.Editors.Settings.Template.EditController + * @function + * + * @description + * The controller for editing templates + */ +function TemplateEditController($scope, navigationService) { + $scope.template = "

Hej

"; +} + +angular.module("umbraco").controller("Umbraco.Editors.Settings.Template.EditController", TemplateEditController); diff --git a/src/Umbraco.Web.UI.Client/src/views/settings/template/edit.html b/src/Umbraco.Web.UI.Client/src/views/templates/edit.html similarity index 96% rename from src/Umbraco.Web.UI.Client/src/views/settings/template/edit.html rename to src/Umbraco.Web.UI.Client/src/views/templates/edit.html index 8c29f11ff5..2c7048f7a2 100644 --- a/src/Umbraco.Web.UI.Client/src/views/settings/template/edit.html +++ b/src/Umbraco.Web.UI.Client/src/views/templates/edit.html @@ -1,19 +1,19 @@ -
- - -

woop

-
- -
-
-
- -
-
-
-