2012-12-31 02:51:30 +03:00
|
|
|
|
using System.Text;
|
|
|
|
|
|
using Umbraco.Core.IO;
|
|
|
|
|
|
using umbraco.businesslogic;
|
|
|
|
|
|
using umbraco.cms.presentation.Trees;
|
2013-03-22 13:13:05 +00:00
|
|
|
|
using Umbraco.Core;
|
2012-12-31 02:51:30 +03:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web.Trees
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Tree for displaying partial view macros in the developer app
|
|
|
|
|
|
/// </summary>
|
2013-03-22 13:13:05 +00:00
|
|
|
|
[Tree(Constants.Applications.Developer, "partialViewMacros", "Partial View Macro Files", sortOrder: 6)]
|
2012-12-31 02:51:30 +03:00
|
|
|
|
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(
|
2013-05-08 14:18:18 -10:00
|
|
|
|
@"
|
2012-12-31 02:51:30 +03:00
|
|
|
|
function openMacroPartialView(id) {
|
2013-05-08 14:18:18 -10:00
|
|
|
|
UmbClientMgr.contentFrame('Settings/Views/EditView.aspx?treeType=partialViewMacros&file=MacroPartials%2f' + id);
|
2012-12-31 02:51:30 +03:00
|
|
|
|
}
|
|
|
|
|
|
");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void ChangeNodeAction(XmlTreeNode xNode)
|
|
|
|
|
|
{
|
|
|
|
|
|
xNode.Action = xNode.Action.Replace("openFile", "openMacroPartialView");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|