When creating partial views from templates, also replace (Model.Content) with (Model) - building upon the logic in e2d41106

This commit is contained in:
Kenn Jacobsen
2019-04-04 19:41:39 +02:00
parent d0b9fb7d6f
commit 6e1a40e2ee

View File

@@ -1034,10 +1034,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
//Update Model.Content to be Model when used as PartialView
if (partialViewType == PartialViewType.PartialView)
{
snippetContent = snippetContent.Replace("Model.Content.", "Model.");
snippetContent = snippetContent
.Replace("Model.Content.", "Model.")
.Replace("(Model.Content)", "(Model)");
}
var content = $"{partialViewHeader}{Environment.NewLine}{snippetContent}";