Files
Umbraco-CMS/src/Umbraco.Web.BackOffice/Trees/PartialViewsTreeController.cs

40 lines
1.5 KiB
C#

using Microsoft.AspNetCore.Authorization;
using Umbraco.Core.IO;
using Umbraco.Core.Services;
using Umbraco.Web.Common.Attributes;
using Umbraco.Web.Common.Authorization;
using Umbraco.Web.Trees;
using Umbraco.Web.WebApi;
using Constants = Umbraco.Core.Constants;
namespace Umbraco.Web.BackOffice.Trees
{
/// <summary>
/// Tree for displaying partial views in the settings app
/// </summary>
[Tree(Core.Constants.Applications.Settings, Core.Constants.Trees.PartialViews, SortOrder = 7, TreeGroup = Core.Constants.Trees.Groups.Templating)]
[Authorize(Policy = AuthorizationPolicies.TreeAccessPartialViews)]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
public class PartialViewsTreeController : FileSystemTreeController
{
protected override IFileSystem FileSystem { get; }
private static readonly string[] ExtensionsStatic = {"cshtml"};
protected override string[] Extensions => ExtensionsStatic;
protected override string FileIcon => "icon-article";
public PartialViewsTreeController(
ILocalizedTextService localizedTextService,
UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection,
IMenuItemCollectionFactory menuItemCollectionFactory,
IFileSystems fileSystems)
: base(localizedTextService, umbracoApiControllerTypeCollection, menuItemCollectionFactory)
{
FileSystem = fileSystems.PartialViewsFileSystem;
}
}
}