Files
Umbraco-CMS/src/Umbraco.Web/Trees/PartialViewMacrosTree.cs
Shannon Deminick 1f87470f89 Fixes up tree syncing for views, stylesheets and partial views. Now ensures we can actually
sync a tree for a file based node that doesn't have a static id. Also ensures that when we change a
Partial view name that we don't end up duplicating some files when we change it twice in the
same session.
2013-05-08 14:18:18 -10:00

41 lines
1.3 KiB
C#

using System.Text;
using Umbraco.Core.IO;
using umbraco.businesslogic;
using umbraco.cms.presentation.Trees;
using Umbraco.Core;
namespace Umbraco.Web.Trees
{
/// <summary>
/// Tree for displaying partial view macros in the developer app
/// </summary>
[Tree(Constants.Applications.Developer, "partialViewMacros", "Partial View Macro Files", sortOrder: 6)]
public class PartialViewMacrosTree : PartialViewsTree
{
public PartialViewMacrosTree(string application) : base(application)
{
}
protected override string FilePath
{
get { return SystemDirectories.MvcViews + "/MacroPartials/"; }
}
public override void RenderJS(ref StringBuilder javascript)
{
//NOTE: Notice the MacroPartials%2f string below, this is a URLEncoded string of "MacroPartials/" so that the editor knows
// to load the file from the correct location
javascript.Append(
@"
function openMacroPartialView(id) {
UmbClientMgr.contentFrame('Settings/Views/EditView.aspx?treeType=partialViewMacros&file=MacroPartials%2f' + id);
}
");
}
protected override void ChangeNodeAction(XmlTreeNode xNode)
{
xNode.Action = xNode.Action.Replace("openFile", "openMacroPartialView");
}
}
}