2017-09-12 16:22:16 +02:00
|
|
|
|
using umbraco;
|
2016-03-30 16:07:45 +02:00
|
|
|
|
using Umbraco.Core.IO;
|
2017-05-30 18:13:11 +02:00
|
|
|
|
using Umbraco.Web.Composing;
|
2016-03-30 16:07:45 +02:00
|
|
|
|
using Umbraco.Web.Models.Trees;
|
2017-09-12 16:22:16 +02:00
|
|
|
|
using Umbraco.Web.Mvc;
|
|
|
|
|
|
using Umbraco.Web.WebApi.Filters;
|
|
|
|
|
|
using Constants = Umbraco.Core.Constants;
|
2016-03-30 16:07:45 +02:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web.Trees
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Tree for displaying partial views in the settings app
|
|
|
|
|
|
/// </summary>
|
2018-10-05 11:51:34 +02:00
|
|
|
|
[Tree(Constants.Applications.Settings, Constants.Trees.PartialViews, null, sortOrder: 7)]
|
2017-09-12 16:22:16 +02:00
|
|
|
|
[UmbracoTreeAuthorize(Constants.Trees.PartialViews)]
|
|
|
|
|
|
[PluginController("UmbracoTrees")]
|
2018-10-05 13:11:38 +01:00
|
|
|
|
[CoreTree(TreeGroup = Constants.Trees.Groups.Templating)]
|
2016-03-30 16:07:45 +02:00
|
|
|
|
public class PartialViewsTreeController : FileSystemTreeController
|
|
|
|
|
|
{
|
2017-05-12 14:49:44 +02:00
|
|
|
|
protected override IFileSystem FileSystem => Current.FileSystems.PartialViewsFileSystem;
|
2016-03-30 16:07:45 +02:00
|
|
|
|
|
2017-09-12 16:22:16 +02:00
|
|
|
|
private static readonly string[] ExtensionsStatic = {"cshtml"};
|
2016-03-30 16:07:45 +02:00
|
|
|
|
|
2017-05-12 14:49:44 +02:00
|
|
|
|
protected override string[] Extensions => ExtensionsStatic;
|
2016-03-30 16:07:45 +02:00
|
|
|
|
|
2017-05-12 14:49:44 +02:00
|
|
|
|
protected override string FileIcon => "icon-article";
|
2016-03-30 16:07:45 +02:00
|
|
|
|
|
2017-05-12 14:49:44 +02:00
|
|
|
|
protected override void OnRenderFolderNode(ref TreeNode treeNode)
|
2016-03-30 16:07:45 +02:00
|
|
|
|
{
|
2017-05-12 14:49:44 +02:00
|
|
|
|
//TODO: This isn't the best way to ensure a noop process for clicking a node but it works for now.
|
|
|
|
|
|
treeNode.AdditionalData["jsClickCallback"] = "javascript:void(0);";
|
2018-10-10 16:27:13 +01:00
|
|
|
|
treeNode.Icon = "icon-folder";
|
2016-03-30 16:07:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|