diff --git a/old/zero.Core/Entities/IconSet.cs b/old/zero.Core/Entities/IconSet.cs
deleted file mode 100644
index a3dcec95..00000000
--- a/old/zero.Core/Entities/IconSet.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-namespace zero.Core.Entities
-{
- ///
- /// Define a backoffice icon set
- ///
- public class IconSet
- {
- ///
- /// The alias
- ///
- public string Alias { get; set; }
-
- ///
- /// Name of the icon set
- ///
- public string Name { get; set; }
-
- ///
- /// Prefix for addressing symbols (by default the alias)
- ///
- public string Prefix { get; set; }
-
- ///
- /// Path to the SVG sprite
- ///
- public string SpritePath { get; set; }
- }
-}
diff --git a/old/zero.Web/Defaults/ZeroBackofficePlugin.cs b/old/zero.Web/Defaults/ZeroBackofficePlugin.cs
index 845f4342..00f43f93 100644
--- a/old/zero.Web/Defaults/ZeroBackofficePlugin.cs
+++ b/old/zero.Web/Defaults/ZeroBackofficePlugin.cs
@@ -8,13 +8,6 @@ namespace zero.Web.Defaults
{
internal class ZeroBackofficePlugin : ZeroPlugin
{
- public ZeroBackofficePlugin()
- {
- Options.Name = "zero.Defaults";
- Options.LocalizationPaths.Add("~/Resources/Localization/zero.{lang}.json");
- }
-
-
public override void Configure(IZeroOptions zero)
{
zero.Sections.Add();
@@ -31,12 +24,7 @@ namespace zero.Web.Defaults
zero.Permissions.AddCollection();
zero.Permissions.AddCollection();
- zero.Icons.AddSet("feather", "Feather", "/assets/icons/feather.svg", "fth");
zero.Pages.Add(Constants.Pages.FolderAlias, "@page.folder.name", "@page.folder.description", "fth-folder");
-
- zero.Interceptors.Add(gravity: 100);
- zero.Interceptors.Add(gravity: -1);
- zero.Interceptors.Add(gravity: -1);
}
diff --git a/zero.Backoffice/Configuration/BackofficeIconSet.cs b/zero.Backoffice/Configuration/BackofficeIconSet.cs
new file mode 100644
index 00000000..247491b2
--- /dev/null
+++ b/zero.Backoffice/Configuration/BackofficeIconSet.cs
@@ -0,0 +1,27 @@
+namespace zero.Backoffice.Configuration;
+
+///
+/// Define a backoffice icon set
+///
+public class BackofficeIconSet
+{
+ ///
+ /// The alias for reference
+ ///
+ public string Alias { get; set; }
+
+ ///
+ /// Name of the icon set
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// Optional symbol identifier prefix (by default the alias is used)
+ ///
+ public string Prefix { get; set; }
+
+ ///
+ /// Path to the SVG sprite containing addressable symbols
+ ///
+ public string SpritePath { get; set; }
+}
\ No newline at end of file
diff --git a/zero.Backoffice/Configuration/BackofficeOptions.cs b/zero.Backoffice/Configuration/BackofficeOptions.cs
new file mode 100644
index 00000000..bf7bccbc
--- /dev/null
+++ b/zero.Backoffice/Configuration/BackofficeOptions.cs
@@ -0,0 +1,29 @@
+namespace zero.Backoffice.Configuration;
+
+public class BackofficeOptions
+{
+ ///
+ /// URL path to the backoffice (defaults to /zero)
+ ///
+ public string Path { get; set; }
+
+ ///
+ /// Paths in the backoffice which are not handled by zero
+ ///
+ public List ExcludedPaths { get; private set; } = new();
+
+ ///
+ /// Define icon sets which can be used in icon pickers (and also in backoffice rendering)
+ ///
+ public List IconSets { get; set; } = new();
+
+ ///
+ /// Authentication configuration for external services
+ ///
+ public ExternalServicesOptions ExternalServices { get; set; } = new();
+
+ ///
+ /// Configure search maps
+ ///
+ public SearchOptions Search { get; set; } = new();
+}
\ No newline at end of file
diff --git a/zero.Core/Configuration/ConfigurationParts/ServiceOptions.cs b/zero.Backoffice/Configuration/ExternalServicesOptions.cs
similarity index 65%
rename from zero.Core/Configuration/ConfigurationParts/ServiceOptions.cs
rename to zero.Backoffice/Configuration/ExternalServicesOptions.cs
index ddecf6fc..da5fc2d8 100644
--- a/zero.Core/Configuration/ConfigurationParts/ServiceOptions.cs
+++ b/zero.Backoffice/Configuration/ExternalServicesOptions.cs
@@ -1,6 +1,6 @@
-namespace zero.Configuration;
+namespace zero.Backoffice.Configuration;
-public class ServiceOptions
+public class ExternalServicesOptions
{
///
/// Define a YouTube API Key so the zero videopicker can display previews
diff --git a/zero.Backoffice/Endpoints/BackofficeController.cs b/zero.Backoffice/Endpoints/ZeroBackofficeController.cs
similarity index 100%
rename from zero.Backoffice/Endpoints/BackofficeController.cs
rename to zero.Backoffice/Endpoints/ZeroBackofficeController.cs
diff --git a/zero.Backoffice/Module.cs b/zero.Backoffice/Module.cs
deleted file mode 100644
index cfa0ba0f..00000000
--- a/zero.Backoffice/Module.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.DependencyInjection.Extensions;
-using Microsoft.Extensions.Options;
-
-namespace zero.Backoffice;
-
-internal class BackofficeModule : ZeroModule
-{
- ///
- public override void Register(IZeroModuleConfiguration config)
- {
- config.Services.TryAddEnumerable(ServiceDescriptor.Transient, ZeroBackofficeMvcOptions>());
- }
-}
\ No newline at end of file
diff --git a/zero.Backoffice/Modules/Search/Module.cs b/zero.Backoffice/Modules/Search/Module.cs
index df802828..ae64de72 100644
--- a/zero.Backoffice/Modules/Search/Module.cs
+++ b/zero.Backoffice/Modules/Search/Module.cs
@@ -7,7 +7,6 @@ internal class SearchModule : ZeroModule
///
public override void Register(IZeroModuleConfiguration config)
{
- config.Services.AddOptions().Bind(config.Configuration.GetSection(SearchOptions.KEY));
config.Services.AddScoped();
}
diff --git a/zero.Backoffice/Modules/Search/SearchOptions.cs b/zero.Backoffice/Modules/Search/SearchOptions.cs
index a4c2ddc0..b3e425f6 100644
--- a/zero.Backoffice/Modules/Search/SearchOptions.cs
+++ b/zero.Backoffice/Modules/Search/SearchOptions.cs
@@ -2,27 +2,8 @@
public class SearchOptions : OptionsEnumerable, IOptionsEnumerable
{
- public static string KEY { get; set; } = "Zero:Backoffice:Search";
-
public bool Enabled { get; set; }
-
- public SearchOptions()
- {
- Enabled = true;
- //Map().Display((x, res, opts) =>
- //{
- // PageType pageType = opts.Pages.GetByAlias(x.PageTypeAlias);
- // if (pageType != null)
- // {
- // res.Icon = pageType.Icon;
- // }
- // res.Url = "/pages/edit/" + x.Id;
- //});
- //Map("fth-image");
- }
-
-
public SearchIndexMap Map(string icon = null) where T : ZeroEntity, new()
{
SearchIndexMap map = new(icon);
diff --git a/zero.Backoffice/Plugin.cs b/zero.Backoffice/Plugin.cs
new file mode 100644
index 00000000..f9deaa16
--- /dev/null
+++ b/zero.Backoffice/Plugin.cs
@@ -0,0 +1,55 @@
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.Extensions.Options;
+
+namespace zero.Backoffice;
+
+internal class ZeroBackofficePlugin : ZeroPlugin
+{
+ public ZeroBackofficePlugin()
+ {
+ Options.Name = "zero.Defaults";
+ Options.LocalizationPaths.Add("~/Resources/Localization/zero.{lang}.json");
+ }
+
+
+ public override void ConfigureServices(IServiceCollection services, IConfiguration configuration)
+ {
+ services.AddOptions().Bind(configuration.GetSection("Zero:Backoffice")).Configure(ConfigureOptions);
+ services.TryAddEnumerable(ServiceDescriptor.Transient, ZeroBackofficeMvcOptions>());
+
+ // register all modules
+ ZeroModuleConfiguration moduleConfig = new(services, configuration);
+ foreach (ZeroModule module in Registrations.Modules)
+ {
+ module.Register(moduleConfig);
+ }
+ }
+
+
+ protected void ConfigureOptions(BackofficeOptions options)
+ {
+ options.Path = "/zero";
+ options.IconSets.Add(new BackofficeIconSet()
+ {
+ Alias = "feather",
+ Name = "Feather",
+ SpritePath = "/assets/icons/feather.svg",
+ Prefix = "fth"
+ });
+
+ options.Search.Enabled = true;
+ //Map().Display((x, res, opts) =>
+ //{
+ // PageType pageType = opts.Pages.GetByAlias(x.PageTypeAlias);
+ // if (pageType != null)
+ // {
+ // res.Icon = pageType.Icon;
+ // }
+ // res.Url = "/pages/edit/" + x.Id;
+ //});
+ //Map("fth-image");
+ }
+}
\ No newline at end of file
diff --git a/zero.Backoffice/Registrations.cs b/zero.Backoffice/Registrations.cs
new file mode 100644
index 00000000..b03565f0
--- /dev/null
+++ b/zero.Backoffice/Registrations.cs
@@ -0,0 +1,10 @@
+namespace zero.Backoffice;
+
+internal class Registrations
+{
+ public static List Modules { get; } = new()
+ {
+ new CountriesModule(),
+ new SearchModule()
+ };
+}
\ No newline at end of file
diff --git a/zero.Backoffice/Usings.cs b/zero.Backoffice/Usings.cs
index 5d184060..3f1b03cb 100644
--- a/zero.Backoffice/Usings.cs
+++ b/zero.Backoffice/Usings.cs
@@ -24,4 +24,5 @@ global using zero.Applications;
global using zero.Backoffice;
global using zero.Backoffice.Models;
-global using zero.Backoffice.Modules;
\ No newline at end of file
+global using zero.Backoffice.Modules;
+global using zero.Backoffice.Configuration;
\ No newline at end of file
diff --git a/zero.Core/Architecture/Blueprints/BlueprintChildInterceptor.cs b/zero.Core/Architecture/Blueprints/BlueprintChildInterceptor.cs
index 5263050d..8fe58e46 100644
--- a/zero.Core/Architecture/Blueprints/BlueprintChildInterceptor.cs
+++ b/zero.Core/Architecture/Blueprints/BlueprintChildInterceptor.cs
@@ -7,6 +7,7 @@ public class BlueprintChildInterceptor : Interceptor, IBlueprintInte
public BlueprintChildInterceptor(IZeroContext context)
{
+ Gravity = -1;
configuredZeroDatabase = context.Options.For().Database;
}
diff --git a/zero.Core/Architecture/Blueprints/BlueprintInterceptor.cs b/zero.Core/Architecture/Blueprints/BlueprintInterceptor.cs
index a7cce1f6..a940a460 100644
--- a/zero.Core/Architecture/Blueprints/BlueprintInterceptor.cs
+++ b/zero.Core/Architecture/Blueprints/BlueprintInterceptor.cs
@@ -23,6 +23,7 @@ public class BlueprintInterceptor : Interceptor, IBlueprintIntercept
public BlueprintInterceptor(IZeroContext context, IZeroStore store, ILogger logger, IBlueprintService blueprintService, IInterceptors interceptors)
{
+ Gravity = -1;
Context = context;
Store = store;
Logger = logger;
diff --git a/zero.Core/Architecture/Module.cs b/zero.Core/Architecture/Module.cs
index 6275afcb..ff6163d2 100644
--- a/zero.Core/Architecture/Module.cs
+++ b/zero.Core/Architecture/Module.cs
@@ -7,7 +7,7 @@ internal class ArchitectureModule : ZeroModule
///
public override void Register(IZeroModuleConfiguration config)
{
- config.Services.AddScoped();
+ config.Services.AddScoped();
config.Services.AddScoped();
config.Services.AddScoped();
}
diff --git a/zero.Core/Architecture/Modules/ZeroModuleConfiguration.cs b/zero.Core/Architecture/Modules/ZeroModuleConfiguration.cs
index 0c3fedd9..6f8267b8 100644
--- a/zero.Core/Architecture/Modules/ZeroModuleConfiguration.cs
+++ b/zero.Core/Architecture/Modules/ZeroModuleConfiguration.cs
@@ -9,7 +9,7 @@ public class ZeroModuleConfiguration : IZeroModuleConfiguration
public IConfiguration Configuration { get; }
- internal ZeroModuleConfiguration(IServiceCollection servicse, IConfiguration configuration)
+ public ZeroModuleConfiguration(IServiceCollection servicse, IConfiguration configuration)
{
Services = servicse;
Configuration = configuration;
diff --git a/zero.Core/Architecture/BaseEntities/IZeroRouteEntity.cs b/zero.Core/BaseEntities/IZeroRouteEntity.cs
similarity index 88%
rename from zero.Core/Architecture/BaseEntities/IZeroRouteEntity.cs
rename to zero.Core/BaseEntities/IZeroRouteEntity.cs
index 91dd72a5..6528b5ac 100644
--- a/zero.Core/Architecture/BaseEntities/IZeroRouteEntity.cs
+++ b/zero.Core/BaseEntities/IZeroRouteEntity.cs
@@ -1,4 +1,4 @@
-namespace zero.Architecture;
+namespace zero;
public interface IZeroRouteEntity
{
diff --git a/zero.Core/Architecture/BaseEntities/ZeroEntity.cs b/zero.Core/BaseEntities/ZeroEntity.cs
similarity index 98%
rename from zero.Core/Architecture/BaseEntities/ZeroEntity.cs
rename to zero.Core/BaseEntities/ZeroEntity.cs
index 1b0723ca..63be5d9e 100644
--- a/zero.Core/Architecture/BaseEntities/ZeroEntity.cs
+++ b/zero.Core/BaseEntities/ZeroEntity.cs
@@ -1,7 +1,7 @@
using Newtonsoft.Json;
using System.Diagnostics;
-namespace zero.Architecture;
+namespace zero;
[DebuggerDisplay("Id = {Id,nq}, Name = {Name}, Alias = {Alias}")]
public class ZeroEntity : ZeroIdEntity, IZeroDbConventions, IZeroRouteEntity
diff --git a/zero.Core/Architecture/BaseEntities/ZeroIdEntity.cs b/zero.Core/BaseEntities/ZeroIdEntity.cs
similarity index 78%
rename from zero.Core/Architecture/BaseEntities/ZeroIdEntity.cs
rename to zero.Core/BaseEntities/ZeroIdEntity.cs
index 976887a5..0efadec4 100644
--- a/zero.Core/Architecture/BaseEntities/ZeroIdEntity.cs
+++ b/zero.Core/BaseEntities/ZeroIdEntity.cs
@@ -1,4 +1,4 @@
-namespace zero.Architecture;
+namespace zero;
public class ZeroIdEntity
{
diff --git a/zero.Core/Communication/Module.cs b/zero.Core/Communication/Module.cs
index fde71425..5e70c9e4 100644
--- a/zero.Core/Communication/Module.cs
+++ b/zero.Core/Communication/Module.cs
@@ -7,6 +7,7 @@ internal class CommunicationModule : ZeroModule
///
public override void Register(IZeroModuleConfiguration config)
{
+ config.Services.AddScoped();
config.Services.AddSingleton();
config.Services.AddTransient();
}
diff --git a/zero.Core/Configuration/ConfigurationParts/IconOptions.cs b/zero.Core/Configuration/ConfigurationParts/IconOptions.cs
deleted file mode 100644
index 632b3daf..00000000
--- a/zero.Core/Configuration/ConfigurationParts/IconOptions.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-namespace zero.Configuration;
-
-public class IconOptions : OptionsEnumerable, IOptionsEnumerable
-{
- ///
- /// Add a new backoffice icon set
- ///
- /// Alias for reference
- /// Name of the icon set
- /// Path to the SVG sprite containing addressable symbols
- /// Optional symbol identifier prefix (by default the alias is used)
- public void AddSet(string alias, string name, string spritePath, string prefix = null)
- {
- Items.Add(new IconSet()
- {
- Alias = alias,
- Name = name,
- SpritePath = spritePath,
- Prefix = prefix ?? alias
- });
- }
-}
\ No newline at end of file
diff --git a/zero.Core/Configuration/ZeroOptions.cs b/zero.Core/Configuration/ZeroOptions.cs
index 58f15ed4..6c3e86aa 100644
--- a/zero.Core/Configuration/ZeroOptions.cs
+++ b/zero.Core/Configuration/ZeroOptions.cs
@@ -66,14 +66,6 @@ public class ZeroOptions : IZeroOptions
/////
//public ApplicationOptions Applications { get; set; }
- /////
- //public string BackofficePath { get; set; }
-
- /////
- ///// Paths in the backoffice which are not handled by zero
- /////
- //public List ExcludedPaths { get; private set; }
-
/////
//public SectionOptions Sections { get; private set; }
@@ -98,12 +90,6 @@ public class ZeroOptions : IZeroOptions
/////
//public IntegrationOptions Integrations { get; private set; }
- /////
- //public IconOptions Icons { get; private set; }
-
- /////
- //public ServiceOptions Services { get; private set; }
-
/////
//public BlueprintOptions Blueprints { get; private set; }
}
@@ -151,14 +137,4 @@ public interface IZeroOptions
///// Application options
/////
//ApplicationOptions Applications { get; set; }
-
- /////
- ///// URL path to the backoffice (defaults to /zero)
- /////
- //string BackofficePath { get; set; }
-
- /////
- ///// Paths in the backoffice which are not handled by zero
- /////
- //List ExcludedPaths { get; }
}