Move sections to their own namespace

This commit is contained in:
Stephan
2019-02-18 11:22:25 +01:00
parent 30b5dd4d04
commit 7185089f1d
23 changed files with 95 additions and 91 deletions

View File

@@ -0,0 +1,17 @@
using Umbraco.Core;
using Umbraco.Core.Models.Sections;
namespace Umbraco.Web.Sections
{
/// <summary>
/// Defines the back office content section
/// </summary>
public class ContentSection : ISection
{
/// <inheritdoc />
public string Alias => Constants.Applications.Content;
/// <inheritdoc />
public string Name => "Content";
}
}

View File

@@ -0,0 +1,14 @@
using Umbraco.Core;
using Umbraco.Core.Models.Sections;
namespace Umbraco.Web.Sections
{
/// <summary>
/// Defines the back office media section
/// </summary>
public class FormsSection : ISection
{
public string Alias => Constants.Applications.Forms;
public string Name => "Forms";
}
}

View File

@@ -0,0 +1,14 @@
using Umbraco.Core;
using Umbraco.Core.Models.Sections;
namespace Umbraco.Web.Sections
{
/// <summary>
/// Defines the back office media section
/// </summary>
public class MediaSection : ISection
{
public string Alias => Constants.Applications.Media;
public string Name => "Media";
}
}

View File

@@ -0,0 +1,17 @@
using Umbraco.Core;
using Umbraco.Core.Models.Sections;
namespace Umbraco.Web.Sections
{
/// <summary>
/// Defines the back office members section
/// </summary>
public class MembersSection : ISection
{
/// <inheritdoc />
public string Alias => Constants.Applications.Members;
/// <inheritdoc />
public string Name => "Members";
}
}

View File

@@ -0,0 +1,17 @@
using Umbraco.Core;
using Umbraco.Core.Models.Sections;
namespace Umbraco.Web.Sections
{
/// <summary>
/// Defines the back office packages section
/// </summary>
public class PackagesSection : ISection
{
/// <inheritdoc />
public string Alias => Constants.Applications.Packages;
/// <inheritdoc />
public string Name => "Packages";
}
}

View File

@@ -0,0 +1,13 @@
using System.Collections.Generic;
using Umbraco.Core.Composing;
using Umbraco.Core.Models.Sections;
namespace Umbraco.Web.Sections
{
public class SectionCollection : BuilderCollectionBase<ISection>
{
public SectionCollection(IEnumerable<ISection> items)
: base(items)
{ }
}
}

View File

@@ -0,0 +1,24 @@
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Manifest;
using Umbraco.Core.Models.Sections;
namespace Umbraco.Web.Sections
{
public class SectionCollectionBuilder : OrderedCollectionBuilderBase<SectionCollectionBuilder, SectionCollection, ISection>
{
protected override SectionCollectionBuilder This => this;
protected override IEnumerable<ISection> CreateItems(IFactory factory)
{
// get the manifest parser just-in-time - injecting it in the ctor would mean that
// simply getting the builder in order to configure the collection, would require
// its dependencies too, and that can create cycles or other oddities
var manifestParser = factory.GetInstance<ManifestParser>();
return base.CreateItems(factory).Concat(manifestParser.Manifest.Sections);
}
}
}

View File

@@ -0,0 +1,17 @@
using Umbraco.Core;
using Umbraco.Core.Models.Sections;
namespace Umbraco.Web.Sections
{
/// <summary>
/// Defines the back office settings section
/// </summary>
public class SettingsSection : ISection
{
/// <inheritdoc />
public string Alias => Constants.Applications.Settings;
/// <inheritdoc />
public string Name => "Settings";
}
}

View File

@@ -0,0 +1,17 @@
using Umbraco.Core;
using Umbraco.Core.Models.Sections;
namespace Umbraco.Web.Sections
{
/// <summary>
/// Defines the back office translation section
/// </summary>
public class TranslationSection : ISection
{
/// <inheritdoc />
public string Alias => Constants.Applications.Translation;
/// <inheritdoc />
public string Name => "Translation";
}
}

View File

@@ -0,0 +1,17 @@
using Umbraco.Core;
using Umbraco.Core.Models.Sections;
namespace Umbraco.Web.Sections
{
/// <summary>
/// Defines the back office users section
/// </summary>
public class UsersSection : ISection
{
/// <inheritdoc />
public string Alias => Constants.Applications.Users;
/// <inheritdoc />
public string Name => "Users";
}
}