diff --git a/zero.Core/Entities/Sections/ISection.cs b/zero.Core/Entities/Sections/ISection.cs index 1b0947f2..4c32cc49 100644 --- a/zero.Core/Entities/Sections/ISection.cs +++ b/zero.Core/Entities/Sections/ISection.cs @@ -22,6 +22,11 @@ namespace zero.Core.Entities /// string Icon { get; } + /// + /// HEX color (#aabbcc or #abc) + /// + string Color { get; } + /// /// Children are displayed as a sub-navigation in the main nav area /// diff --git a/zero.Core/Entities/Sections/Section.cs b/zero.Core/Entities/Sections/Section.cs index b722632e..824e2621 100644 --- a/zero.Core/Entities/Sections/Section.cs +++ b/zero.Core/Entities/Sections/Section.cs @@ -16,17 +16,23 @@ namespace zero.Core.Entities /// public string Icon { get; } + /// + /// HEX color (#aabbcc or #abc). Defaults to a neutral color + /// + public string Color { get; } + /// public IList Children { get; } = new List(); public Section() { } - public Section(string alias, string name, string icon) + public Section(string alias, string name, string icon, string color = null) { Alias = alias; Name = name; Icon = icon; + Color = color; } } } diff --git a/zero.Web/Controllers/BackofficeController.cs b/zero.Web/Controllers/BackofficeController.cs index 90339f79..34c27315 100644 --- a/zero.Web/Controllers/BackofficeController.cs +++ b/zero.Web/Controllers/BackofficeController.cs @@ -1,8 +1,5 @@ using Microsoft.AspNetCore.Mvc; -using System; -using System.Linq; using zero.Core; -using zero.Core.Entities; namespace zero.Web.Controllers { diff --git a/zero.Web/Sections/DashboardSection.cs b/zero.Web/Sections/DashboardSection.cs index 643101b6..97172442 100644 --- a/zero.Web/Sections/DashboardSection.cs +++ b/zero.Web/Sections/DashboardSection.cs @@ -18,6 +18,9 @@ namespace zero.Web.Sections /// public string Icon => "fth-pie-chart"; + /// + public string Color => null; + /// public IList Children => null; } diff --git a/zero.Web/Sections/ListsSection.cs b/zero.Web/Sections/ListsSection.cs index a6160a12..604e124f 100644 --- a/zero.Web/Sections/ListsSection.cs +++ b/zero.Web/Sections/ListsSection.cs @@ -18,6 +18,9 @@ namespace zero.Web.Sections /// public string Icon => "fth-layers"; + /// + public string Color => "#f9c202"; + /// public IList Children => null; } diff --git a/zero.Web/Sections/MediaSection.cs b/zero.Web/Sections/MediaSection.cs index 37c08b97..44299acc 100644 --- a/zero.Web/Sections/MediaSection.cs +++ b/zero.Web/Sections/MediaSection.cs @@ -18,6 +18,9 @@ namespace zero.Web.Sections /// public string Icon => "fth-image"; + /// + public string Color => "#d82853"; + /// public IList Children => null; } diff --git a/zero.Web/Sections/PagesSection.cs b/zero.Web/Sections/PagesSection.cs index 7413213c..6b6a05ed 100644 --- a/zero.Web/Sections/PagesSection.cs +++ b/zero.Web/Sections/PagesSection.cs @@ -18,6 +18,9 @@ namespace zero.Web.Sections /// public string Icon => "fth-folder"; + /// + public string Color => "#0cb0f5"; + /// public IList Children => null; } diff --git a/zero.Web/Sections/SettingsSection.cs b/zero.Web/Sections/SettingsSection.cs index 6a71ff9f..120d936a 100644 --- a/zero.Web/Sections/SettingsSection.cs +++ b/zero.Web/Sections/SettingsSection.cs @@ -18,6 +18,9 @@ namespace zero.Web.Sections /// public string Icon => "fth-settings"; + /// + public string Color => null; + /// public IList Children => null; } diff --git a/zero.Web/ZeroBuilder.cs b/zero.Web/ZeroBuilder.cs new file mode 100644 index 00000000..2edf2977 --- /dev/null +++ b/zero.Web/ZeroBuilder.cs @@ -0,0 +1,22 @@ +using Microsoft.Extensions.DependencyInjection; + +namespace zero.Web +{ + public class ZeroBuilder + { + public virtual IServiceCollection Services { get; } + + + public ZeroBuilder(IServiceCollection services) + { + Services = services; + } + + + //public virtual AuthenticationBuilder AddPolicyScheme(string authenticationScheme, string displayName, Action configureOptions); + + //public virtual AuthenticationBuilder AddRemoteScheme(string authenticationScheme, string displayName, Action configureOptions) + // where TOptions : RemoteAuthenticationOptions, new() + // where THandler : RemoteAuthenticationHandler; + } +} diff --git a/zero.Web/ServiceCollectionExtensions.cs b/zero.Web/ZeroServiceCollectionExtensions.cs similarity index 55% rename from zero.Web/ServiceCollectionExtensions.cs rename to zero.Web/ZeroServiceCollectionExtensions.cs index 9a6afd2b..7ae2aa59 100644 --- a/zero.Web/ServiceCollectionExtensions.cs +++ b/zero.Web/ZeroServiceCollectionExtensions.cs @@ -5,9 +5,9 @@ using zero.Web.Sections; namespace zero.Web { - public static class ServiceCollectionExtensions + public static class ZeroServiceCollectionExtensions { - public static IServiceCollection AddZero(this IServiceCollection services) + public static ZeroBuilder AddZero(this IServiceCollection services) { services.AddOptions() .Configure(opts => @@ -19,12 +19,14 @@ namespace zero.Web opts.Sections.Add(); }); - return services; + return new ZeroBuilder(services); } - public static IServiceCollection AddZero(this IServiceCollection services, Action setupAction) + public static ZeroBuilder AddZero(this IServiceCollection services, Action setupAction) { - return services.AddZero().PostConfigure(setupAction); + ZeroBuilder builder = services.AddZero(); + builder.Services.PostConfigure(setupAction); + return builder; } } }