diff --git a/src/Umbraco.Web.UI/umbraco/config/create/UI.Release.xml b/src/Umbraco.Web.UI/umbraco/config/create/UI.Release.xml index b988bb864a..9860db13de 100644 --- a/src/Umbraco.Web.UI/umbraco/config/create/UI.Release.xml +++ b/src/Umbraco.Web.UI/umbraco/config/create/UI.Release.xml @@ -339,4 +339,22 @@ + + +
Macro
+ /create/simple.ascx + + + + +
+ +
Macro
+ /create/simple.ascx + + + + +
+ \ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco/config/create/UI.xml b/src/Umbraco.Web.UI/umbraco/config/create/UI.xml index fb55e69c6e..532601b95a 100644 --- a/src/Umbraco.Web.UI/umbraco/config/create/UI.xml +++ b/src/Umbraco.Web.UI/umbraco/config/create/UI.xml @@ -349,5 +349,13 @@ + +
Macro
+ /create/simple.ascx + + + + +
\ No newline at end of file diff --git a/src/Umbraco.Web/Trees/PartialViewsTree.cs b/src/Umbraco.Web/Trees/PartialViewsTree.cs index dd7057acdb..dffba223da 100644 --- a/src/Umbraco.Web/Trees/PartialViewsTree.cs +++ b/src/Umbraco.Web/Trees/PartialViewsTree.cs @@ -68,8 +68,8 @@ namespace Umbraco.Web.Trees protected override void OnRenderFileNode(ref XmlTreeNode xNode) { ChangeNodeAction(xNode); - xNode.Icon = "settingsScript.gif"; - xNode.OpenIcon = "settingsScript.gif"; + xNode.Icon = "settingView.gif"; + xNode.OpenIcon = "settingView.gif"; } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 066961f9f6..e67b73f876 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -354,6 +354,7 @@ + ASPXCodeBehind diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MacroPartialViewTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/MacroPartialViewTasks.cs new file mode 100644 index 0000000000..515abb59d5 --- /dev/null +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/MacroPartialViewTasks.cs @@ -0,0 +1,22 @@ +using System.IO; +using Umbraco.Core.CodeAnnotations; +using Umbraco.Web.Macros; + +namespace umbraco +{ + [UmbracoWillObsolete("http://issues.umbraco.org/issue/U4-1373", "This will one day be removed when we overhaul the create process")] + public class MacroPartialViewTasks : PartialViewTasks + { + protected override string ParentFolderName + { + get { return "MacroPartials"; } + } + + protected override void WriteTemplateHeader(StreamWriter sw) + { + //write out the template header + sw.Write("@inherits "); + sw.Write(typeof(PartialViewMacroPage).FullName); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs index dafe2026fb..d6875026b7 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Web; using Umbraco.Core.CodeAnnotations; using Umbraco.Core.IO; using Umbraco.Core.Logging; @@ -19,8 +20,20 @@ namespace umbraco private int _typeId; private int _userId; - private const string EditViewFile = "Settings/Views/EditView.aspx"; - private readonly string _basePath = SystemDirectories.MvcViews + "/Partials/"; + protected virtual string EditViewFile + { + get { return "Settings/Views/EditView.aspx"; } + } + + protected string BasePath + { + get { return SystemDirectories.MvcViews + "/" + ParentFolderName.EnsureEndsWith('/'); } + } + + protected virtual string ParentFolderName + { + get { return "Partials"; } + } public int UserId { @@ -48,30 +61,35 @@ namespace umbraco public bool Save() { var fileName = _alias + ".cshtml"; - var fullFilePath = IOHelper.MapPath(_basePath + fileName); + var fullFilePath = IOHelper.MapPath(BasePath + fileName); //return the link to edit the file if it already exists if (File.Exists(fullFilePath)) { - _returnUrl = string.Format(EditViewFile + "?file={0}", fileName); + _returnUrl = string.Format(EditViewFile + "?file={0}", HttpUtility.UrlEncode(ParentFolderName.EnsureEndsWith('/') + fileName)); return true; } //create the file using (var sw = File.CreateText(fullFilePath)) { - //write out the template header - sw.Write("@inherits "); - sw.Write(typeof(UmbracoViewPage<>).FullName.TrimEnd("`1")); - sw.Write(""); + WriteTemplateHeader(sw); } - _returnUrl = string.Format(EditViewFile + "?file={0}", fileName); + _returnUrl = string.Format(EditViewFile + "?file={0}", HttpUtility.UrlEncode(ParentFolderName.EnsureEndsWith('/') + fileName)); return true; } + protected virtual void WriteTemplateHeader(StreamWriter sw) + { + //write out the template header + sw.Write("@inherits "); + sw.Write(typeof(UmbracoViewPage<>).FullName.TrimEnd("`1")); + sw.Write(""); + } + public bool Delete() { - var path = IOHelper.MapPath(_basePath + _alias.TrimStart('/')); + var path = IOHelper.MapPath(BasePath + _alias.TrimStart('/')); if (File.Exists(path)) File.Delete(path);