mirror of https://github.com/abpframework/abp.git
18 changed files with 93 additions and 2 deletions
@ -0,0 +1,17 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using Microsoft.AspNetCore.Mvc.Rendering; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Theming; |
||||
|
|
||||
|
namespace Volo.CmsKit.Admin.Web.Layouts; |
||||
|
|
||||
|
public static class LayoutConstants |
||||
|
{ |
||||
|
public const string Account = StandardLayouts.Account; |
||||
|
public const string Public = StandardLayouts.Public; |
||||
|
public const string Empty = StandardLayouts.Empty; |
||||
|
public const string Application = StandardLayouts.Application; |
||||
|
public static SelectList GetLayoutsSelectList() |
||||
|
{ |
||||
|
return new SelectList(new List<string> { Account, Public, Empty, Application }, Application); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Theming; |
||||
|
|
||||
|
namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Layouts; |
||||
|
|
||||
|
public static class LayoutExtensions |
||||
|
{ |
||||
|
private static readonly Dictionary<string, Func<ITheme, string>> LayoutFunctions = new() |
||||
|
{ |
||||
|
[StandardLayouts.Account] = theme => theme.GetAccountLayout(), |
||||
|
[StandardLayouts.Public] = theme => theme.GetPublicLayout(), |
||||
|
[StandardLayouts.Empty] = theme => theme.GetEmptyLayout(), |
||||
|
}; |
||||
|
|
||||
|
public static string GetLayoutByKey(this ITheme theme, string layoutKey) |
||||
|
{ |
||||
|
return LayoutFunctions.TryGetValue(layoutKey, out var layoutFunc) |
||||
|
? layoutFunc(theme) |
||||
|
: theme.GetApplicationLayout(); // Application layout is the default
|
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue