diff --git a/docs/en/Themes/Index.md b/docs/en/Themes/Index.md new file mode 100644 index 0000000000..a588e37d3a --- /dev/null +++ b/docs/en/Themes/Index.md @@ -0,0 +1,30 @@ +# The Official Themes +ABP Framework provides a complete UI theming system. While you can build your own themes, you can use the following pre-built themes freely in your applications. + +## The Basic Theme +The Basic Theme is a minimalist theme that doesn't add any styling on top of the plain [Bootstrap](https://getbootstrap.com/) styles. You can take the Basic Theme as the base theme and build your own theme or styling on top of it. Here, a screenshot from the theme: + +![basic-theme-application-layout](../images/basic-theme-application-layout.png) + +### Documentation + +- [Basic Theme - MVC UI](../UI/AspNetCore/Basic-Theme.md) +- [Basic Theme - Blazor UI](../UI/Blazor/Basic-Theme.md) +- [Basic Theme - Angular UI](../UI/Angular/Basic-Theme.md) + +## The LeptonX Lite Theme +**LeptonX Lite** is the free version of the [LeptonX Theme](https://x.leptontheme.com/), which is a part of the ABP Commercial. Here, a screenshot from the theme: + +![LeptonX Lite application layout](../images/leptonxlite-theme-application-layout.jpeg) + +### Documentation + +- [LeptonX Lite - MVC UI](LeptonXLite/AspNetCore.md) +- [LeptonX Lite - Blazor UI](LeptonXLite/Blazor.md) +- [LeptonX Lite - Angular UI](LeptonXLite/Angular.md) + +## See Also + +* [Theming - MVC UI](../UI/AspNetCore/Theming.md) +* [Theming - Blazor UI](../UI/Blazor/Theming.md) +* [Theming - Angular UI](../UI/Angular/Theming.md) \ No newline at end of file diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index ed9cb37135..ef6b0cad07 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -1198,6 +1198,10 @@ { "text": "Common", "items": [ + { + "text": "Themes", + "path": "Themes/Index.md" + }, { "text": "Overriding the User Interface", "path": "Customizing-Application-Modules-Overriding-User-Interface.md" diff --git a/docs/en/images/leptonxlite-theme-application-layout.jpeg b/docs/en/images/leptonxlite-theme-application-layout.jpeg new file mode 100644 index 0000000000..12e15ddcb7 Binary files /dev/null and b/docs/en/images/leptonxlite-theme-application-layout.jpeg differ diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Args/AngularThemeConfigurationArgs.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Args/AngularThemeConfigurationArgs.cs new file mode 100644 index 0000000000..3422697dba --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Args/AngularThemeConfigurationArgs.cs @@ -0,0 +1,19 @@ +using Volo.Abp.Cli.ProjectBuilding.Building; + +namespace Volo.Abp.Cli.Args; + +public class AngularThemeConfigurationArgs +{ + public Theme Theme { get; } + + public string ProjectName { get; } + + public string AngularFolderPath { get; } + + public AngularThemeConfigurationArgs(Theme theme, string projectName, string angularFolderPath) + { + Theme = theme; + ProjectName = projectName; + AngularFolderPath = angularFolderPath; + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index d104c313ed..8421eb656b 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -40,7 +40,8 @@ public class NewCommand : ProjectCreationCommandBase, IConsoleCommand, ITransien ILocalEventBus eventBus, IBundlingService bundlingService, ITemplateInfoProvider templateInfoProvider, - TemplateProjectBuilder templateProjectBuilder) : + TemplateProjectBuilder templateProjectBuilder, + AngularThemeConfigurer angularThemeConfigurer) : base(connectionStringProvider, solutionPackageVersionFinder, cmdHelper, @@ -50,7 +51,8 @@ public class NewCommand : ProjectCreationCommandBase, IConsoleCommand, ITransien initialMigrationCreator, themePackageAdder, eventBus, - bundlingService) + bundlingService, + angularThemeConfigurer) { TemplateInfoProvider = templateInfoProvider; TemplateProjectBuilder = templateProjectBuilder; @@ -95,6 +97,7 @@ public class NewCommand : ProjectCreationCommandBase, IConsoleCommand, ITransien Logger.LogInformation($"'{projectName}' has been successfully created to '{projectArgs.OutputFolder}'"); + ConfigureAngularJsonForThemeSelection(projectArgs); ConfigureNpmPackagesForTheme(projectArgs); await RunGraphBuildForMicroserviceServiceTemplate(projectArgs); await CreateInitialMigrationsAsync(projectArgs); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs index eae01cf503..0ab182bac1 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs @@ -19,6 +19,7 @@ using Volo.Abp.Cli.ProjectBuilding.Events; using Volo.Abp.Cli.ProjectBuilding.Templates.App; using Volo.Abp.Cli.ProjectBuilding.Templates.Microservice; using Volo.Abp.Cli.ProjectBuilding.Templates.Module; +using Volo.Abp.Cli.ProjectBuilding.Templates.MvcModule; using Volo.Abp.Cli.Utils; using Volo.Abp.EventBus.Local; @@ -38,6 +39,8 @@ public abstract class ProjectCreationCommandBase public ILogger Logger { get; set; } public ThemePackageAdder ThemePackageAdder { get; } + + public AngularThemeConfigurer AngularThemeConfigurer { get; } public ProjectCreationCommandBase( ConnectionStringProvider connectionStringProvider, @@ -49,7 +52,8 @@ public abstract class ProjectCreationCommandBase InitialMigrationCreator initialMigrationCreator, ThemePackageAdder themePackageAdder, ILocalEventBus eventBus, - IBundlingService bundlingService) + IBundlingService bundlingService, + AngularThemeConfigurer angularThemeConfigurer) { _bundlingService = bundlingService; ConnectionStringProvider = connectionStringProvider; @@ -61,6 +65,7 @@ public abstract class ProjectCreationCommandBase InitialMigrationCreator = initialMigrationCreator; EventBus = eventBus; ThemePackageAdder = themePackageAdder; + AngularThemeConfigurer = angularThemeConfigurer; Logger = NullLogger.Instance; } @@ -667,6 +672,32 @@ public abstract class ProjectCreationCommandBase } } + protected void ConfigureAngularJsonForThemeSelection(ProjectBuildArgs projectArgs) + { + var theme = projectArgs.Theme; + var isProTemplate = !projectArgs.TemplateName.IsNullOrEmpty() && projectArgs.TemplateName.EndsWith("-pro", StringComparison.OrdinalIgnoreCase); + var isDefaultTheme = (isProTemplate && theme == AppProTemplate.DefaultTheme) || + (!isProTemplate && theme == AppTemplate.DefaultTheme); + + if (isDefaultTheme || projectArgs.TemplateName == ModuleTemplate.TemplateName) + { + return; + } + + if (theme.HasValue && projectArgs.UiFramework == UiFramework.Angular) + { + var angularFolderPath = projectArgs.TemplateName == MicroserviceProTemplate.TemplateName + ? projectArgs.OutputFolder.EnsureEndsWith(Path.DirectorySeparatorChar) + "apps" + Path.DirectorySeparatorChar + "angular" + : projectArgs.OutputFolder.EnsureEndsWith(Path.DirectorySeparatorChar) + "angular"; + + AngularThemeConfigurer.Configure(new AngularThemeConfigurationArgs( + theme: theme.Value, + projectName: projectArgs.SolutionName.FullName, + angularFolderPath: angularFolderPath + )); + } + } + public static class Options { public static class Template diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularThemeConfigurer.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularThemeConfigurer.cs new file mode 100644 index 0000000000..4df9e31d47 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularThemeConfigurer.cs @@ -0,0 +1,30 @@ +using System; +using Volo.Abp.Cli.Args; +using Volo.Abp.Cli.Utils; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Cli.ProjectModification; + +public class AngularThemeConfigurer : ITransientDependency +{ + private readonly ICmdHelper _cmdHelper; + + public AngularThemeConfigurer(ICmdHelper cmdHelper) + { + _cmdHelper = cmdHelper; + } + + public void Configure(AngularThemeConfigurationArgs args) + { + if (args.ProjectName.IsNullOrEmpty() || args.AngularFolderPath.IsNullOrEmpty()) + { + return; + } + + var command = "npx ng g @abp/ng.schematics:change-theme " + + $"--name {(int)args.Theme} " + + $"--target-project {args.ProjectName}"; + + _cmdHelper.RunCmd(command, workingDirectory: args.AngularFolderPath); + } +} \ No newline at end of file