From 46c30435d8007ecdde20135c7f281fd59fc335b2 Mon Sep 17 00:00:00 2001 From: Robbware Date: Mon, 9 Oct 2023 16:34:55 +0100 Subject: [PATCH] Add the ability to override the TopMenu component on the MainLayout --- COMET.Web.Common/Model/GlobalOptions.cs | 5 +++ .../IRegistrationService.cs | 2 + .../RegistrationService.cs | 7 ++++ COMET.Web.Common/Shared/MainLayout.razor | 13 ++++-- COMET.Web.Common/Shared/MainLayout.razor.cs | 42 +++++++++++++++++++ 5 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 COMET.Web.Common/Shared/MainLayout.razor.cs diff --git a/COMET.Web.Common/Model/GlobalOptions.cs b/COMET.Web.Common/Model/GlobalOptions.cs index eab1ab256..443fb2fdd 100644 --- a/COMET.Web.Common/Model/GlobalOptions.cs +++ b/COMET.Web.Common/Model/GlobalOptions.cs @@ -70,6 +70,11 @@ public class GlobalOptions /// Defines the that should be used as MainLayout /// public Type MainLayoutType { get; set; } = typeof(MainLayout); + + /// + /// Defines the that should be used as TopMenu + /// + public Type TopMenuType { get; set; } = typeof(TopMenu); } } \ No newline at end of file diff --git a/COMET.Web.Common/Services/RegistrationService/IRegistrationService.cs b/COMET.Web.Common/Services/RegistrationService/IRegistrationService.cs index b68d7c396..ee996e6ee 100644 --- a/COMET.Web.Common/Services/RegistrationService/IRegistrationService.cs +++ b/COMET.Web.Common/Services/RegistrationService/IRegistrationService.cs @@ -59,5 +59,7 @@ public interface IRegistrationService /// Gets the to use as MainLayout for the application /// Type MainLayoutType { get; } + + Type TopMenuType { get; } } } diff --git a/COMET.Web.Common/Services/RegistrationService/RegistrationService.cs b/COMET.Web.Common/Services/RegistrationService/RegistrationService.cs index 0cd564d94..683b9d45b 100644 --- a/COMET.Web.Common/Services/RegistrationService/RegistrationService.cs +++ b/COMET.Web.Common/Services/RegistrationService/RegistrationService.cs @@ -63,12 +63,19 @@ public RegistrationService(IOptions options) this.registeredAuthorizedTopMenuEntries.AddRange(options.Value.AdditionalMenuEntries); this.CustomHeader = options.Value.CustomHeaderTitle; this.MainLayoutType = options.Value.MainLayoutType; + this.TopMenuType = options.Value.TopMenuType; } /// /// Gets the to use as MainLayout for the application /// public Type MainLayoutType { get; } + + /// + /// Gets the to use as TopMenu for the application + /// + + public Type TopMenuType { get; } /// /// Gets the of registered diff --git a/COMET.Web.Common/Shared/MainLayout.razor b/COMET.Web.Common/Shared/MainLayout.razor index 08796510e..384651731 100644 --- a/COMET.Web.Common/Shared/MainLayout.razor +++ b/COMET.Web.Common/Shared/MainLayout.razor @@ -32,9 +32,16 @@ - +