diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/codefile.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/codefile.resource.js index 44454f21e3..7cd55b268a 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/codefile.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/codefile.resource.js @@ -199,11 +199,17 @@ function codefileResource($q, $http, umbDataFormatter, umbRequestHelper) { */ getScaffold: function (type, id, snippetName) { + + var queryString = "?type=" + type + "&id=" + id; + if (snippetName) { + queryString += "&snippetName=" + snippetName; + } + return umbRequestHelper.resourcePromise( $http.get( umbRequestHelper.getApiUrl( - "codeFileApiBaseUrl", - "GetScaffold?type=" + type + "&id=" + id + "&snippetName=" + snippetName)), + "codeFileApiBaseUrl", + "GetScaffold" + queryString)), "Failed to get scaffold for" + type); }, diff --git a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js index b1464e5c9d..020ac9c710 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js @@ -522,6 +522,26 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, notifica return true; } return false; + }, + + /** + * @ngdoc function + * @name umbraco.services.contentEditingHelper#redirectToRenamedContent + * @methodOf umbraco.services.contentEditingHelper + * @function + * + * @description + * For some editors like scripts or entites that have names as ids, these names can change and we need to redirect + * to their new paths, this is helper method to do that. + */ + redirectToRenamedContent: function (id) { + //clear the query strings + $location.search(""); + //change to new path + $location.path("/" + $routeParams.section + "/" + $routeParams.tree + "/" + $routeParams.method + "/" + id); + //don't add a browser history for this + $location.replace(); + return true; } }; }