Merge branch 'partial-view-folders' of https://github.com/pynej/Umbraco-CMS into 7.2.0

This commit is contained in:
Shannon
2014-10-21 13:21:12 +10:00
12 changed files with 57 additions and 8 deletions

View File

@@ -3,7 +3,7 @@
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<cc1:Pane runat="server">
<cc1:PropertyPanel runat="server" Text="Filename (without .cshtml)">
<cc1:PropertyPanel runat="server" Text="Filename (without .cshtml, use / to make folders)">
<asp:TextBox ID="FileName" runat="server" CssClass="bigInput input-large-type input-block-level"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ErrorMessage="*" ControlToValidate="FileName" runat="server">*</asp:RequiredFieldValidator>
</cc1:PropertyPanel>

View File

@@ -19,6 +19,10 @@ namespace Umbraco.Web.UI.Umbraco.Create
DataBind();
LoadTemplates(PartialViewTemplate);
// Enable new contect item in folders to place items in that folder.
if (Request["nodeType"] == "partialViewsFolder")
FileName.Text = Request["nodeId"] + "/";
}
private static void LoadTemplates(ListControl list)

View File

@@ -330,6 +330,14 @@
<delete assembly="umbraco" type="PartialViewTasks" />
</tasks>
</nodeType>
<nodeType alias="partialViewsFolder">
<header>Macro</header>
<usercontrol>/Create/PartialView.ascx</usercontrol>
<tasks>
<create assembly="umbraco" type="PartialViewTasks" />
<delete assembly="umbraco" type="PartialViewTasks" />
</tasks>
</nodeType>
<nodeType alias="partialViewMacros">
<header>Macro</header>
<usercontrol>/Create/PartialViewMacro.ascx</usercontrol>
@@ -338,4 +346,12 @@
<delete assembly="umbraco" type="PartialViewMacroTasks" />
</tasks>
</nodeType>
<nodeType alias="partialViewMacrosFolder">
<header>Macro</header>
<usercontrol>/Create/PartialViewMacro.ascx</usercontrol>
<tasks>
<create assembly="umbraco" type="PartialViewMacroTasks" />
<delete assembly="umbraco" type="PartialViewMacroTasks" />
</tasks>
</nodeType>
</createUI>

View File

@@ -4,7 +4,7 @@
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<cc1:Pane runat="server">
<cc1:PropertyPanel runat="server" Text="Filename (without .cshtml)">
<cc1:PropertyPanel runat="server" Text="Filename (without .cshtml, use / to make folders)">
<asp:TextBox ID="FileName" runat="server" CssClass="bigInput input-large-type input-block-level"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ErrorMessage="*" ControlToValidate="FileName" runat="server">*</asp:RequiredFieldValidator>
</cc1:PropertyPanel>

View File

@@ -19,6 +19,10 @@ namespace Umbraco.Web.UI.Umbraco.Create
DataBind();
LoadTemplates(PartialViewTemplate);
// Enable new contect item in folders to place items in that folder.
if (Request["nodeType"] == "partialViewMacrosFolder")
FileName.Text = Request["nodeId"] + "/";
}
private static void LoadTemplates(ListControl list)

View File

@@ -3,7 +3,7 @@
<input type="hidden" name="nodeType" value="-1"/>
<cc1:Pane runat="server">
<cc1:PropertyPanel runat="server" Text="Name">
<cc1:PropertyPanel runat="server" Text="Name (use / to make folders)">
<asp:TextBox ID="rename" runat="server" CssClass="bigInput input-large-type input-block-level"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ErrorMessage="*" ControlToValidate="rename" runat="server">*</asp:RequiredFieldValidator>
</cc1:PropertyPanel>

View File

@@ -150,7 +150,10 @@ namespace Umbraco.Web.UI.Umbraco.Settings.Views
{
//we are editing a view (i.e. partial view)
OriginalFileName = HttpUtility.UrlDecode(Request.QueryString["file"]);
TemplateTreeSyncPath = "-1,init," + Path.GetFileName(OriginalFileName);
//TemplateTreeSyncPath = "-1,init," + Path.GetFileName(OriginalFileName);
TemplateTreeSyncPath = DeepLink.GetTreePathFromFilePath(OriginalFileName.TrimStart("MacroPartials/").TrimStart("Partials/"));
}
else
{

View File

@@ -31,7 +31,17 @@ namespace Umbraco.Web.Trees
UmbClientMgr.contentFrame('Settings/Views/EditView.aspx?treeType=partialViewMacros&file=MacroPartials%2f' + id);
}
");
}
}/// <summary>
/// Ensures that no folders can be added
/// </summary>
/// <param name="xNode"></param>
protected override void OnRenderFolderNode(ref XmlTreeNode xNode)
{
base.OnRenderFolderNode(ref xNode);
xNode.NodeType = "partialViewMacrosFolder";
}
protected override void ChangeNodeAction(XmlTreeNode xNode)
{

View File

@@ -57,7 +57,11 @@ namespace Umbraco.Web.Trees
/// <param name="xNode"></param>
protected override void OnRenderFolderNode(ref XmlTreeNode xNode)
{
xNode = null;
// We should allow folder hierarchy for organization in large sites.
xNode.Action = "javascript:void(0);";
xNode.NodeType = "partialViewsFolder";
xNode.Menu = new List<IAction>(new IAction[] { ActionDelete.Instance, ContextMenuSeperator.Instance, ActionNew.Instance, ContextMenuSeperator.Instance, ActionRefresh.Instance });
}
protected virtual void ChangeNodeAction(XmlTreeNode xNode)

View File

@@ -76,6 +76,7 @@ namespace umbraco
xNode.Menu = new List<IAction>(new IAction[] { ActionDelete.Instance, ContextMenuSeperator.Instance, ActionNew.Instance, ContextMenuSeperator.Instance, ActionRefresh.Instance });
xNode.Action = "javascript:void(0)";
xNode.NodeType = "scriptsFolder";
xNode.Action = "javascript:void(0);";
}
protected override void OnRenderFileNode(ref XmlTreeNode xNode)

View File

@@ -3,7 +3,7 @@
<input type="hidden" name="nodeType" value="-1"/>
<cc1:Pane runat="server">
<cc1:PropertyPanel runat="server" Text="Name">
<cc1:PropertyPanel runat="server" Text="Name (use / to make folders)">
<asp:TextBox ID="rename" runat="server" CssClass="bigInput input-large-type input-block-level"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ErrorMessage="*" ControlToValidate="rename" runat="server">*</asp:RequiredFieldValidator>
</cc1:PropertyPanel>

View File

@@ -254,7 +254,7 @@ namespace umbraco.cms.businesslogic.web
{
var e = new DeleteEventArgs();
FireBeforeDelete(e);
if (!e.Cancel)
{
File.Delete(IOHelper.MapPath(String.Format("{0}/{1}.css", SystemDirectories.Css, this.Text)));
@@ -272,6 +272,13 @@ namespace umbraco.cms.businesslogic.web
public void saveCssToFile()
{
if (this.Text.Contains('/'))
{
var dir = string.Format("{0}/{1}", IOHelper.MapPath(SystemDirectories.Css), this.Text.Substring(0, this.Text.LastIndexOf('/')));
if (!Directory.Exists(dir))
Directory.CreateDirectory(dir);
}
using (StreamWriter SW = File.CreateText(IOHelper.MapPath(string.Format("{0}/{1}.css", SystemDirectories.Css, this.Text))))
{
string tmpCss = this.Content ;