diff --git a/src/Umbraco.Core/IO/ViewHelper.cs b/src/Umbraco.Core/IO/ViewHelper.cs index 28dad49dc0..c4b31ad347 100644 --- a/src/Umbraco.Core/IO/ViewHelper.cs +++ b/src/Umbraco.Core/IO/ViewHelper.cs @@ -66,7 +66,7 @@ namespace Umbraco.Core.IO return viewContent; } - internal static string GetDefaultFileContent(string layoutPageAlias = null) + internal static string GetDefaultFileContent(string layoutPageAlias = null, string modelClassName = null) { var design = @"@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ @@ -76,6 +76,10 @@ namespace Umbraco.Core.IO if (layoutPageAlias.IsNullOrWhiteSpace() == false) design = design.Replace("null", string.Format("\"{0}.cshtml\"", layoutPageAlias)); + if (modelClassName.IsNullOrWhiteSpace() == false) + design = design.Replace(".UmbracoTemplatePage", string.Format(".UmbracoTemplatePage<{0}>", modelClassName)); + + return design; } diff --git a/src/Umbraco.Web/Editors/ContentTypeController.cs b/src/Umbraco.Web/Editors/ContentTypeController.cs index b875687dd0..13bb039051 100644 --- a/src/Umbraco.Web/Editors/ContentTypeController.cs +++ b/src/Umbraco.Web/Editors/ContentTypeController.cs @@ -17,6 +17,7 @@ using Umbraco.Core.PropertyEditors; using System; using System.Net.Http; using Umbraco.Core.Services; +using Umbraco.Core.IO; namespace Umbraco.Web.Editors { @@ -164,15 +165,7 @@ namespace Umbraco.Web.Editors if (template == null) { template = new Template(ctSave.Name, ctSave.Alias); - - //POC: temporary models template support, this should really not be handled here but by - //the models builder - var design = @"@inherits Umbraco.Web.Mvc.UmbracoTemplatePage -@{ - Layout = null; -}"; - - template.Content = design.Replace("IPublishedContent", contentTypeSave.Name.ToSafeAlias(false)); + template.Content = ViewHelper.GetDefaultFileContent(modelClassName: ctSave.Name.ToSafeAlias(false)); Services.FileService.SaveTemplate(template); }