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 859255e887..e83bb4f14e 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
@@ -198,12 +198,12 @@ function codefileResource($q, $http, umbDataFormatter, umbRequestHelper) {
*
*/
- getScaffold: function (type, snippetName) {
+ getScaffold: function (type, id, snippetName) {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"codeFileApiBaseUrl",
- "GetScaffold?type=" + type + "&snippetName=" + snippetName)),
+ "GetScaffold?type=" + type + "&id=" + id + "&snippetName=" + snippetName)),
"Failed to get scaffold for" + type);
}
diff --git a/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/edit.controller.js
index a02de75b75..4860773b02 100644
--- a/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/edit.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/edit.controller.js
@@ -236,7 +236,7 @@
snippet = $routeParams.snippet;
}
- codefileResource.getScaffold("partialViewMacros", snippet).then(function (partialViewMacro) {
+ codefileResource.getScaffold("partialViewMacros", $routeParams.id, snippet).then(function (partialViewMacro) {
ready(partialViewMacro);
});
diff --git a/src/Umbraco.Web.UI.Client/src/views/partialviews/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/partialviews/edit.controller.js
index c763a81902..a493ed30c1 100644
--- a/src/Umbraco.Web.UI.Client/src/views/partialviews/edit.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/partialviews/edit.controller.js
@@ -236,7 +236,7 @@
snippet = $routeParams.snippet;
}
- codefileResource.getScaffold("partialViews", snippet).then(function (partialView) {
+ codefileResource.getScaffold("partialViews", $routeParams.id, snippet).then(function (partialView) {
ready(partialView);
});
diff --git a/src/Umbraco.Web.UI.Client/src/views/scripts/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/scripts/edit.controller.js
index 1470833aad..d2a5fcbc0e 100644
--- a/src/Umbraco.Web.UI.Client/src/views/scripts/edit.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/scripts/edit.controller.js
@@ -79,7 +79,7 @@
assetsService.loadCss("lib/ace-razor-mode/theme/razor_chrome.css");
if ($routeParams.create) {
- codefileResource.getScaffold("scripts").then(function(script) {
+ codefileResource.getScaffold("scripts", $routeParams.id).then(function (script) {
ready(script);
});
} else {
diff --git a/src/Umbraco.Web/Editors/CodeFileController.cs b/src/Umbraco.Web/Editors/CodeFileController.cs
index 3948c4853c..72e318010e 100644
--- a/src/Umbraco.Web/Editors/CodeFileController.cs
+++ b/src/Umbraco.Web/Editors/CodeFileController.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
+using System.Web;
using System.Web.Http;
using Umbraco.Core;
using Umbraco.Core.IO;
@@ -148,9 +149,10 @@ namespace Umbraco.Web.Editors
/// Used to scaffold the json object for the editors for 'scripts', 'partialViews', 'partialViewMacros'
///
/// This is a string but will be 'scripts' 'partialViews', 'partialViewMacros'
+ ///
///
///
- public CodeFileDisplay GetScaffold(string type, string snippetName = null)
+ public CodeFileDisplay GetScaffold(string type, string id = null, string snippetName = null)
{
if (string.IsNullOrWhiteSpace(type))
{
@@ -163,23 +165,35 @@ namespace Umbraco.Web.Editors
{
case Core.Constants.Trees.PartialViews:
codeFileDisplay = Mapper.Map(new PartialView(string.Empty));
+ codeFileDisplay.VirtualPath = SystemDirectories.PartialViews;
if (snippetName.IsNullOrWhiteSpace() == false)
codeFileDisplay.Content = Services.FileService.GetPartialViewSnippetContent(snippetName);
break;
case Core.Constants.Trees.PartialViewMacros:
codeFileDisplay = Mapper.Map(new PartialView(string.Empty));
+ codeFileDisplay.VirtualPath = SystemDirectories.MacroPartials;
if (snippetName.IsNullOrWhiteSpace() == false)
codeFileDisplay.Content = Services.FileService.GetPartialViewMacroSnippetContent(snippetName);
break;
case Core.Constants.Trees.Scripts:
codeFileDisplay = Mapper.Map