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
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI.Client/src/views/templates/insertmacro.controller.js b/src/Umbraco.Web.UI.Client/src/views/templates/insertmacro.controller.js
new file mode 100644
index 0000000000..f2ca45977c
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/views/templates/insertmacro.controller.js
@@ -0,0 +1,29 @@
+/**
+ * @ngdoc controller
+ * @name Umbraco.Editors.Templates.InsertMacroController
+ * @function
+ *
+ * @description
+ * The controller for the custom insert macro dialog. Until we upgrade the template editor to be angular this
+ * is actually loaded into an iframe with full html.
+ */
+function InsertMacroController($scope, userService) {
+
+ //fetch the authorized status
+ userService.isAuthenticated()
+ .then(function (data) {
+
+ $scope.authenticated = data.authenticated;
+ $scope.user = data.user;
+
+ }, function (reason) {
+ alert("An error occurred checking authentication.");
+ //TODO: We'd need to proxy this call to the main window
+ //notificationsService.error("An error occurred checking authentication.");
+ $scope.authenticated = false;
+ $scope.user = null;
+ });
+
+}
+
+angular.module("umbraco").controller("Umbraco.Editors.Templates.InsertMacroController", InsertMacroController);
diff --git a/src/Umbraco.Web.UI.Client/src/views/templates/insertmacro.html b/src/Umbraco.Web.UI.Client/src/views/templates/insertmacro.html
new file mode 100644
index 0000000000..858a0c0ea5
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/views/templates/insertmacro.html
@@ -0,0 +1,24 @@
+
diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js
index 68246b4268..e19acea068 100644
--- a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js
+++ b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js
@@ -155,6 +155,19 @@ Umbraco.Sys.registerNamespace("Umbraco.Application");
contentFrame.location.reload();
}
},
+
+ /** This is used to launch an angular based modal window instead of the legacy window */
+ openAngularModalWindow: function (options) {
+
+ if (!this.mainWindow().UmbClientMgr) {
+ throw "An angular modal window can only be launched when the modal is running within the main Umbraco application";
+ }
+ else {
+ this.mainWindow().UmbClientMgr.openAngularModalWindow.apply(this.mainWindow().UmbClientMgr, [options]);
+ }
+
+ },
+
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/umbraco_client/Editors/EditTemplate.js b/src/Umbraco.Web.UI/umbraco_client/Editors/EditTemplate.js
index adcf8de50c..b9fb4f0071 100644
--- a/src/Umbraco.Web.UI/umbraco_client/Editors/EditTemplate.js
+++ b/src/Umbraco.Web.UI/umbraco_client/Editors/EditTemplate.js
@@ -11,7 +11,13 @@
if (alias != null && alias != "") {
t = "&alias=" + alias;
}
- UmbClientMgr.openModalWindow(this._opts.umbracoPath + '/dialogs/editMacro.aspx?renderingEngine=Webforms&objectId=' + this._opts.editorClientId + t, 'Insert Macro', true, 470, 530, 0, 0, '', '');
+ UmbClientMgr.openAngularModalWindow({
+ template: "views/templates/insertmacro.html",
+ dialogData: {
+ renderingEngine: "Webforms",
+ objectId: this._opts.editorClientId + t
+ }
+ });
},
_insertMacro: function(alias) {
diff --git a/src/Umbraco.Web/Editors/EntityController.cs b/src/Umbraco.Web/Editors/EntityController.cs
index 81a3ca9413..747e0c3713 100644
--- a/src/Umbraco.Web/Editors/EntityController.cs
+++ b/src/Umbraco.Web/Editors/EntityController.cs
@@ -22,9 +22,21 @@ using Examine.SearchCriteria;
namespace Umbraco.Web.Editors
{
///
- /// The API controller used for getting entity objects, basic name, icon, id representation of any umbraco object
+ /// API controller to deal with Macro data
///
[PluginController("UmbracoApi")]
+ public class MacroController : UmbracoAuthorizedJsonController
+ {
+
+ }
+
+ ///
+ /// The API controller used for getting entity objects, basic name, icon, id representation of umbraco objects that are based on CMSNode
+ ///
+ ///
+ /// Some objects such as macros are not based on CMSNode
+ ///
+ [PluginController("UmbracoApi")]
public class EntityController : UmbracoAuthorizedJsonController
{
[EnsureUserPermissionForContent("id")]
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index 4117a9e89c..44800e4adc 100644
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -1944,7 +1944,9 @@
-
+
+ ASPXCodeBehind
+