diff --git a/docs/en/framework/ui/mvc-razor-pages/customization-user-interface.md b/docs/en/framework/ui/mvc-razor-pages/customization-user-interface.md index 976b3add87..db76542e5c 100644 --- a/docs/en/framework/ui/mvc-razor-pages/customization-user-interface.md +++ b/docs/en/framework/ui/mvc-razor-pages/customization-user-interface.md @@ -468,10 +468,10 @@ ABP uses the `ITheme` service to get the layout location by the layout name. You @using Volo.Abp.AspNetCore.Mvc.UI.Theming @inject IThemeManager ThemeManager @{ - Layout = await ThemeManager.GetCurrentEmptyLayoutAsync(); + Layout = await ThemeManager.GetCurrentThemeEmptyLayoutAsync(); } ```` -This page will use the empty layout. You use `ThemeManager.GetCurrentEmptyLayoutAsync` extension method as a shortcut. +This page will use the empty layout. You use `ThemeManager.GetCurrentThemeEmptyLayoutAsync` extension method as a shortcut. If you want to set the layout for all the pages under a specific folder, then write the code above in a `_ViewStart.cshtml` file under that folder. diff --git a/framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Theming/ThemeExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Theming/ThemeExtensions.cs index 4814e4e41d..f8c7252b91 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Theming/ThemeExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Theming/ThemeExtensions.cs @@ -50,22 +50,27 @@ public static class ThemeExtensions return await theme.GetLayoutAsync(StandardLayouts.Empty, fallbackToDefault); } - public async static Task GetCurrentApplicationLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true) + public async static Task GetCurrentThemeLayoutAsync(this IThemeManager themeManager, string name, bool fallbackToDefault = true) + { + return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(name, fallbackToDefault); + } + + public async static Task GetCurrentThemeApplicationLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true) { return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(StandardLayouts.Application, fallbackToDefault); } - public async static Task GetCurrentAccountLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true) + public async static Task GetCurrentThemeAccountLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true) { return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(StandardLayouts.Account, fallbackToDefault); } - public async static Task GetCurrentPublicLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true) + public async static Task GetCurrentThemePublicLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true) { return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(StandardLayouts.Public, fallbackToDefault); } - public async static Task GetCurrentEmptyLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true) + public async static Task GetCurrentThemeEmptyLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true) { return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(StandardLayouts.Empty, fallbackToDefault); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Areas/_ViewStart.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Areas/_ViewStart.cshtml index 036947bf38..f5871e6bb8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Areas/_ViewStart.cshtml +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Areas/_ViewStart.cshtml @@ -1,5 +1,5 @@ @using Volo.Abp.AspNetCore.Mvc.UI.Theming @inject IThemeManager ThemeManager @{ - Layout = await ThemeManager.GetCurrentApplicationLayoutAsync(); + Layout = await ThemeManager.GetCurrentThemeApplicationLayoutAsync(); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Account/_ViewStart.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Account/_ViewStart.cshtml index 036947bf38..f5871e6bb8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Account/_ViewStart.cshtml +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Account/_ViewStart.cshtml @@ -1,5 +1,5 @@ @using Volo.Abp.AspNetCore.Mvc.UI.Theming @inject IThemeManager ThemeManager @{ - Layout = await ThemeManager.GetCurrentApplicationLayoutAsync(); + Layout = await ThemeManager.GetCurrentThemeApplicationLayoutAsync(); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/_ViewStart.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/_ViewStart.cshtml index 036947bf38..f5871e6bb8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/_ViewStart.cshtml +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/_ViewStart.cshtml @@ -1,5 +1,5 @@ @using Volo.Abp.AspNetCore.Mvc.UI.Theming @inject IThemeManager ThemeManager @{ - Layout = await ThemeManager.GetCurrentApplicationLayoutAsync(); + Layout = await ThemeManager.GetCurrentThemeApplicationLayoutAsync(); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Views/_ViewStart.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Views/_ViewStart.cshtml index 036947bf38..f5871e6bb8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Views/_ViewStart.cshtml +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Views/_ViewStart.cshtml @@ -1,5 +1,5 @@ @using Volo.Abp.AspNetCore.Mvc.UI.Theming @inject IThemeManager ThemeManager @{ - Layout = await ThemeManager.GetCurrentApplicationLayoutAsync(); + Layout = await ThemeManager.GetCurrentThemeApplicationLayoutAsync(); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/ThemeExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/ThemeExtensions.cs index dae52da796..21991a192d 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/ThemeExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/ThemeExtensions.cs @@ -49,22 +49,27 @@ public static class ThemeExtensions return await theme.GetLayoutAsync(StandardLayouts.Empty, fallbackToDefault); } - public async static Task GetCurrentApplicationLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true) + public async static Task GetCurrentThemeLayoutAsync(this IThemeManager themeManager, string name, bool fallbackToDefault = true) + { + return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(name, fallbackToDefault); + } + + public async static Task GetCurrentThemeApplicationLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true) { return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(StandardLayouts.Application, fallbackToDefault); } - public async static Task GetCurrentAccountLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true) + public async static Task GetCurrentThemeAccountLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true) { return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(StandardLayouts.Account, fallbackToDefault); } - public async static Task GetCurrentPublicLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true) + public async static Task GetCurrentThemePublicLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true) { return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(StandardLayouts.Public, fallbackToDefault); } - public async static Task GetCurrentEmptyLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true) + public async static Task GetCurrentThemeEmptyLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true) { return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(StandardLayouts.Empty, fallbackToDefault); } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.cshtml index e6433d4d4b..7c349a5d51 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.cshtml @@ -7,7 +7,7 @@ @inject IThemeManager ThemeManager @inject IHtmlLocalizer L @{ - Layout = await ThemeManager.GetCurrentApplicationLayoutAsync(); + Layout = await ThemeManager.GetCurrentThemeApplicationLayoutAsync(); } @section scripts { diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml index 8f88066c46..b94b8728a5 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml @@ -12,7 +12,7 @@ @inject Volo.Abp.Settings.ISettingProvider SettingProvider @{ - Layout = await ThemeManager.GetCurrentAccountLayoutAsync(); + Layout = await ThemeManager.GetCurrentThemeAccountLayoutAsync(); } @section scripts diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml index 4475a05c07..88232e5ec1 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml @@ -7,7 +7,7 @@ @inject IHtmlLocalizer L @model ManageModel @{ - Layout = await ThemeManager.GetCurrentApplicationLayoutAsync(); + Layout = await ThemeManager.GetCurrentThemeApplicationLayoutAsync(); } @section scripts { diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/_Layout.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/_Layout.cshtml index e14bc14126..aad4724d56 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/_Layout.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/_Layout.cshtml @@ -1,7 +1,7 @@ @using Volo.Abp.AspNetCore.Mvc.UI.Theming @inject IThemeManager ThemeManager @{ - Layout = await ThemeManager.GetCurrentAccountLayoutAsync(); + Layout = await ThemeManager.GetCurrentThemeAccountLayoutAsync(); }