When creating a PartialView we do a string.replace for Model.Content. to be Model. as MacroPartialViews work with Model.Content and PartialViews like Model.

This commit is contained in:
Warren Buckley
2019-01-29 10:46:10 +00:00
parent 89a99e1c5f
commit e2d4110685

View File

@@ -764,6 +764,12 @@ namespace Umbraco.Core.Services.Implement
//strip the @inherits if it's there
snippetContent = StripPartialViewHeader(snippetContent);
//Update Model.Content. to be Model. when used as PartialView
if(partialViewType == PartialViewType.PartialView)
{
snippetContent = snippetContent.Replace("Model.Content.", "Model.");
}
partialViewContent = $"{partialViewHeader}{Environment.NewLine}{snippetContent}";
}
}
@@ -790,7 +796,7 @@ namespace Umbraco.Core.Services.Implement
}
return Attempt<IPartialView>.Succeed(partialView);
}
}
public bool DeletePartialView(string path, int userId = 0)
{
@@ -1027,6 +1033,12 @@ namespace Umbraco.Core.Services.Implement
//strip the @inherits if it's there
snippetContent = StripPartialViewHeader(snippetContent);
//Update Model.Content. to be Model. when used as PartialView
if (partialViewType == PartialViewType.PartialView)
{
snippetContent = snippetContent.Replace("Model.Content.", "Model.");
}
var content = $"{partialViewHeader}{Environment.NewLine}{snippetContent}";
return content;
}