diff --git a/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js b/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js index 75f0850ee2..06d6c11c71 100644 --- a/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js +++ b/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js @@ -361,6 +361,12 @@ Umbraco.Sys.registerNamespace("Umbraco.Application"); rootScope : function(){ return getRootScope(); }, + + reloadLocation: function() { + var injector = getRootInjector(); + var $route = injector.get("$route"); + $route.reload(); + }, closeModalWindow: function(rVal) { diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/ChangeDocType.aspx.cs b/src/Umbraco.Web.UI/umbraco/dialogs/ChangeDocType.aspx.cs index 783506a1d1..0db3b6c36e 100644 --- a/src/Umbraco.Web.UI/umbraco/dialogs/ChangeDocType.aspx.cs +++ b/src/Umbraco.Web.UI/umbraco/dialogs/ChangeDocType.aspx.cs @@ -256,7 +256,7 @@ namespace Umbraco.Web.UI.Umbraco.Dialogs ClientTools.SyncTree(_content.Path, true); // Reload the page if the content was already being viewed - ClientTools.ReloadContentFrameUrlIfPathLoaded("/editContent.aspx?id=" + _content.Id); + ClientTools.ReloadLocation(); // Display success message SuccessMessage.Text = global::umbraco.ui.Text("changeDocType", "successMessage").Replace("[new type]", "" + newContentType.Name + ""); diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js index 82cec69d81..88f385eac3 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js +++ b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js @@ -151,7 +151,6 @@ Umbraco.Sys.registerNamespace("Umbraco.Application"); /** 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"; } @@ -173,6 +172,12 @@ Umbraco.Sys.registerNamespace("Umbraco.Application"); }, + reloadLocation: function () { + if (this.mainWindow().UmbClientMgr) { + this.mainWindow().UmbClientMgr.reloadLocation(); + } + }, + 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/Pages/ClientTools.cs b/src/Umbraco.Web/UI/Pages/ClientTools.cs index ebb778183d..44464676a4 100644 --- a/src/Umbraco.Web/UI/Pages/ClientTools.cs +++ b/src/Umbraco.Web/UI/Pages/ClientTools.cs @@ -52,6 +52,7 @@ namespace Umbraco.Web.UI.Pages { return string.Format(ClientMgrScript + ".reloadContentFrameUrlIfPathLoaded('{0}');", url); } + public static string ReloadLocation { get { return string.Format(ClientMgrScript + ".reloadLocation();"); } } public static string ChildNodeCreated = GetMainTree + ".childNodeCreated();"; public static string SyncTree { get { return GetMainTree + ".syncTree('{0}', {1});"; } } public static string ClearTreeCache { get { return GetMainTree + ".clearTreeCache();"; } } @@ -173,6 +174,16 @@ namespace Umbraco.Web.UI.Pages return this; } + /// + /// Reloads location, refreshing what is in the content frame + /// + public ClientTools ReloadLocation() + { + RegisterClientScript(Scripts.ReloadLocation); + + return this; + } + private string EnsureUmbracoUrl(string url) { if (url.StartsWith("/") && url.StartsWith(IOHelper.ResolveUrl(SystemDirectories.Umbraco)) == false) diff --git a/src/umbraco.businesslogic/BasePages/ClientTools.cs b/src/umbraco.businesslogic/BasePages/ClientTools.cs index 627c4c1efb..47c7890fc8 100644 --- a/src/umbraco.businesslogic/BasePages/ClientTools.cs +++ b/src/umbraco.businesslogic/BasePages/ClientTools.cs @@ -52,8 +52,8 @@ namespace umbraco.BasePages public static string ReloadContentFrameUrlIfPathLoaded(string url) { return string.Format(ClientMgrScript + ".reloadContentFrameUrlIfPathLoaded('{0}');", url); } - - public static string ChildNodeCreated = GetMainTree + ".childNodeCreated();"; + public static string ReloadLocation { get { return string.Format(ClientMgrScript + ".reloadLocation();"); } } + public static string ChildNodeCreated = GetMainTree + ".childNodeCreated();"; public static string SyncTree { get { return GetMainTree + ".syncTree('{0}', {1});"; } } public static string ClearTreeCache { get { return GetMainTree + ".clearTreeCache();"; } } public static string CopyNode { get { return GetMainTree + ".copyNode('{0}', '{1}');"; } }