Browse Source

Refactor theme layout methods to include 'Theme' prefix for consistency

Theme-Async
maliming 10 months ago
parent
commit
9a41308af4
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 4
      docs/en/framework/ui/mvc-razor-pages/customization-user-interface.md
  2. 13
      framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Theming/ThemeExtensions.cs
  3. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Areas/_ViewStart.cshtml
  4. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Account/_ViewStart.cshtml
  5. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/_ViewStart.cshtml
  6. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Views/_ViewStart.cshtml
  7. 13
      framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/ThemeExtensions.cs
  8. 2
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.cshtml
  9. 2
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml
  10. 2
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml
  11. 2
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/_Layout.cshtml
  12. 2
      modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/ContentPreview/Default.cshtml
  13. 2
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/_ViewStart.cshtml
  14. 2
      modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml
  15. 2
      modules/docs/src/Volo.Docs.Web/Pages/Documents/Search.cshtml
  16. 2
      modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Views/_ViewStart.cshtml

4
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.

13
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<Type> GetCurrentApplicationLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true)
public async static Task<Type> GetCurrentThemeLayoutAsync(this IThemeManager themeManager, string name, bool fallbackToDefault = true)
{
return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(name, fallbackToDefault);
}
public async static Task<Type> GetCurrentThemeApplicationLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true)
{
return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(StandardLayouts.Application, fallbackToDefault);
}
public async static Task<Type> GetCurrentAccountLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true)
public async static Task<Type> GetCurrentThemeAccountLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true)
{
return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(StandardLayouts.Account, fallbackToDefault);
}
public async static Task<Type> GetCurrentPublicLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true)
public async static Task<Type> GetCurrentThemePublicLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true)
{
return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(StandardLayouts.Public, fallbackToDefault);
}
public async static Task<Type> GetCurrentEmptyLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true)
public async static Task<Type> GetCurrentThemeEmptyLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true)
{
return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(StandardLayouts.Empty, fallbackToDefault);
}

2
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();
}

2
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();
}

2
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();
}

2
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();
}

13
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<string> GetCurrentApplicationLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true)
public async static Task<string> GetCurrentThemeLayoutAsync(this IThemeManager themeManager, string name, bool fallbackToDefault = true)
{
return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(name, fallbackToDefault);
}
public async static Task<string> GetCurrentThemeApplicationLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true)
{
return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(StandardLayouts.Application, fallbackToDefault);
}
public async static Task<string> GetCurrentAccountLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true)
public async static Task<string> GetCurrentThemeAccountLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true)
{
return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(StandardLayouts.Account, fallbackToDefault);
}
public async static Task<string> GetCurrentPublicLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true)
public async static Task<string> GetCurrentThemePublicLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true)
{
return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(StandardLayouts.Public, fallbackToDefault);
}
public async static Task<string> GetCurrentEmptyLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true)
public async static Task<string> GetCurrentThemeEmptyLayoutAsync(this IThemeManager themeManager, bool fallbackToDefault = true)
{
return await (await themeManager.GetCurrentThemeAsync()).GetLayoutAsync(StandardLayouts.Empty, fallbackToDefault);
}

2
modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.cshtml

@ -7,7 +7,7 @@
@inject IThemeManager ThemeManager
@inject IHtmlLocalizer<AccountResource> L
@{
Layout = await ThemeManager.GetCurrentApplicationLayoutAsync();
Layout = await ThemeManager.GetCurrentThemeApplicationLayoutAsync();
}
@section scripts {
<abp-script-bundle name="@typeof(LoggedOutModel).FullName">

2
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

2
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml

@ -7,7 +7,7 @@
@inject IHtmlLocalizer<AccountResource> L
@model ManageModel
@{
Layout = await ThemeManager.GetCurrentApplicationLayoutAsync();
Layout = await ThemeManager.GetCurrentThemeApplicationLayoutAsync();
}
@section scripts {
<abp-script-bundle name="@typeof(ManageModel).FullName"/>

2
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();
}
<div class="abp-account-container">
@RenderBody()

2
modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/ContentPreview/Default.cshtml

@ -5,7 +5,7 @@
@inject IThemeManager ThemeManager
@{
Layout = await ThemeManager.GetCurrentEmptyLayoutAsync();
Layout = await ThemeManager.GetCurrentThemeEmptyLayoutAsync();
}
<div class="mt-3">@await Component.InvokeAsync(typeof(ContentFragmentViewComponent), Model)</div>

2
modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/_ViewStart.cshtml

@ -1,5 +1,5 @@
@using Volo.Abp.AspNetCore.Mvc.UI.Theming
@inject IThemeManager ThemeManager
@{
Layout = await ThemeManager.GetCurrentPublicLayoutAsync();
Layout = await ThemeManager.GetCurrentThemePublicLayoutAsync();
}

2
modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml

@ -29,7 +29,7 @@
@model IndexModel
@{
ViewBag.FluidLayout = true;
Layout = await ThemeManager.GetCurrentEmptyLayoutAsync();
Layout = await ThemeManager.GetCurrentThemeEmptyLayoutAsync();
PageLayout.Content.Title = Model.DocumentPageTitle;
ViewBag.Description = Model.GetDescription();
ViewBag.CanonicalUrl = Model.IsLatestVersion ? null : Model.GetFullUrlOfTheLatestDocument(); //issue #12355

2
modules/docs/src/Volo.Docs.Web/Pages/Documents/Search.cshtml

@ -9,7 +9,7 @@
@inject IPageLayout PageLayout
@model SearchModel
@{
Layout = await ThemeManager.GetCurrentEmptyLayoutAsync();
Layout = await ThemeManager.GetCurrentThemeEmptyLayoutAsync();
}
@section styles {
<style>

2
modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Views/_ViewStart.cshtml

@ -1,5 +1,5 @@
@using Volo.Abp.AspNetCore.Mvc.UI.Theming
@inject IThemeManager ThemeManager
@{
Layout = await ThemeManager.GetCurrentAccountLayoutAsync();
Layout = await ThemeManager.GetCurrentThemeAccountLayoutAsync();
}

Loading…
Cancel
Save