Completes: U4-5846 Remove cmsTemplate.master column and transfer those values over to umbracoNode.parentId, U4-5847 Ensure the path is set correctly for templates in the db, almost done the other template service tasks too.

This commit is contained in:
Shannon
2014-12-05 17:29:47 +11:00
parent 2961370b83
commit d4fd58e038
14 changed files with 163 additions and 74 deletions

View File

@@ -163,6 +163,8 @@ namespace Umbraco.Web.WebServices
[HttpPost]
public JsonResult SaveTemplate(string templateName, string templateAlias, string templateContents, int templateId, int masterTemplateId)
{
//TODO: Change this over to use the new API - Also this will be migrated to a TemplateEditor or ViewEditor when it's all moved to angular
Template t;
bool pathChanged = false;
try
@@ -174,11 +176,12 @@ namespace Umbraco.Web.WebServices
Design = templateContents
};
//check if the master page has changed
if (t.MasterTemplate != masterTemplateId)
//check if the master page has changed - we need to normalize both - if it's 0 or -1, then make it 0... this is easy
// to do with Math.Max
if (Math.Max(t.MasterTemplate, 0) != Math.Max(masterTemplateId, 0))
{
pathChanged = true;
t.MasterTemplate = masterTemplateId;
t.MasterTemplate = Math.Max(masterTemplateId, 0);
pathChanged = true;
}
}
catch (ArgumentException ex)