Ensures virtual path is set on the template, updates the tree controller to render the correct editor if it's webforms, updates the rest service to return the updated contents if the server changes it and updates the UI

This commit is contained in:
Shannon
2015-01-09 17:01:38 +11:00
parent 5bef3593dd
commit caf972cd0f
7 changed files with 16 additions and 10 deletions

View File

@@ -172,8 +172,6 @@ namespace Umbraco.Core.Persistence.Repositories
var o = Database.IsNew(nodeDto) ? Convert.ToInt32(Database.Insert(nodeDto)) : Database.Update(nodeDto);
//Update with new correct path
//TODO: need to fix:
// http://issues.umbraco.org/issue/U4-5846
var parent = Get(template.MasterTemplateId.Value);
if (parent != null)
{
@@ -236,9 +234,6 @@ namespace Umbraco.Core.Persistence.Repositories
var template = (Template)entity;
//TODO: need to fix:
// http://issues.umbraco.org/issue/U4-5846
// And use the ParentId column instead of the extra template parent id column
if (entity.IsPropertyDirty("MasterTemplateId"))
{
var parent = Get(template.MasterTemplateId.Value);
@@ -417,6 +412,7 @@ namespace Umbraco.Core.Persistence.Repositories
}
template.UpdateDate = _viewsFileSystem.GetLastModified(fileName).UtcDateTime;
template.Content = content;
template.VirtualPath = _viewsFileSystem.GetUrl(fileName);
}
private void PopulateMasterpageTemplate(ITemplate template, string fileName)
@@ -431,6 +427,7 @@ namespace Umbraco.Core.Persistence.Repositories
template.UpdateDate = _masterpagesFileSystem.GetLastModified(fileName).UtcDateTime;
template.Content = content;
template.VirtualPath = _masterpagesFileSystem.GetUrl(fileName);
}
#region Implementation of ITemplateRepository

View File

@@ -148,6 +148,9 @@
}
path = args.path;
}
if (args.contents) {
UmbEditor.SetCode(args.contents);
}
top.UmbSpeechBubble.ShowMessage('save', header, msg);
UmbClientMgr.mainTree().setActiveTreeType('templates');

View File

@@ -155,6 +155,9 @@
}
path = args.path;
}
if (args.contents) {
UmbEditor.SetCode(args.contents);
}
UmbClientMgr.mainTree().setActiveTreeType(this._opts.currentTreeType);

View File

@@ -129,9 +129,9 @@ namespace Umbraco.Web.Trees
{
//TODO: Rebuild the language editor in angular, then we dont need to have this at all (which is just a path to the legacy editor)
return Path.GetExtension(template.Path).InvariantEquals(".master")
return template.GetTypeOfRenderingEngine() == RenderingEngine.WebForms
? "/" + queryStrings.GetValue<string>("application") + "/framed/" +
Uri.EscapeDataString("/umbraco/settings/editTemplate.aspx?id=" + template.Id)
Uri.EscapeDataString("/umbraco/settings/editTemplate.aspx?templateID=" + template.Id)
: "/" + queryStrings.GetValue<string>("application") + "/framed/" +
Uri.EscapeDataString("/umbraco/settings/Views/EditView.aspx?treeType=" + Constants.Trees.Templates + "&templateID=" + template.Id);
}

View File

@@ -204,7 +204,11 @@ namespace Umbraco.Web.WebServices
var syncPath = "-1,init," + t.Path.Replace("-1,", "");
return Success(ui.Text("speechBubbles", "templateSavedText"), ui.Text("speechBubbles", "templateSavedHeader"),
new { path = syncPath });
new
{
path = syncPath,
contents = t.Design
});
}
catch (Exception ex)
{

View File

@@ -35,7 +35,6 @@ using umbraco.BusinessLogic.Actions;
namespace umbraco
{
[Obsolete("This is no longer used and will be removed from the codebase in the future")]
//[Tree(Constants.Applications.Settings, "templates", "Templates", sortOrder: 1)]
public class loadTemplates : BaseTree
{
public loadTemplates(string application) : base(application) {}

View File

@@ -74,7 +74,7 @@ namespace umbraco.cms.presentation.settings
}
ClientTools
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadTemplates>().Tree.Alias)
.SetActiveTreeType(Constants.Trees.Templates)
.SyncTree(TemplateTreeSyncPath, false);
LoadScriptingTemplates();