Update module template

pull/9169/head
liangshiwei 4 years ago
parent 65f4ef79d4
commit cd52a7c99c

@ -20,8 +20,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\..\modules\account\src\Volo.Abp.Account.Application.Contracts\Volo.Abp.Account.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\identity\src\Volo.Abp.Identity.Blazor.WebAssembly\Volo.Abp.Identity.Blazor.WebAssembly.csproj" /> <ProjectReference Include="..\..\..\..\..\modules\identity\src\Volo.Abp.Identity.Blazor.WebAssembly\Volo.Abp.Identity.Blazor.WebAssembly.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\account\src\Volo.Abp.Account.Blazor\Volo.Abp.Account.Blazor.csproj" /> <ProjectReference Include="..\..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.Blazor.WebAssembly\Volo.Abp.TenantManagement.Blazor.WebAssembly.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.Blazor.WebAssembly\Volo.Abp.SettingManagement.Blazor.WebAssembly.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -5,7 +5,7 @@ using Blazorise.Icons.FontAwesome;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Account.Blazor; using Volo.Abp.Account;
using Volo.Abp.AspNetCore.Components.Web.BasicTheme.Themes.Basic; using Volo.Abp.AspNetCore.Components.Web.BasicTheme.Themes.Basic;
using Volo.Abp.AspNetCore.Components.Web.Theming.Routing; using Volo.Abp.AspNetCore.Components.Web.Theming.Routing;
using Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme; using Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme;
@ -13,6 +13,8 @@ using Volo.Abp.Autofac.WebAssembly;
using Volo.Abp.AutoMapper; using Volo.Abp.AutoMapper;
using Volo.Abp.Identity.Blazor.WebAssembly; using Volo.Abp.Identity.Blazor.WebAssembly;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.SettingManagement.Blazor.WebAssembly;
using Volo.Abp.TenantManagement.Blazor.WebAssembly;
using Volo.Abp.UI.Navigation; using Volo.Abp.UI.Navigation;
namespace MyCompanyName.MyProjectName.Blazor.Host namespace MyCompanyName.MyProjectName.Blazor.Host
@ -20,8 +22,10 @@ namespace MyCompanyName.MyProjectName.Blazor.Host
[DependsOn( [DependsOn(
typeof(AbpAutofacWebAssemblyModule), typeof(AbpAutofacWebAssemblyModule),
typeof(AbpAspNetCoreComponentsWebAssemblyBasicThemeModule), typeof(AbpAspNetCoreComponentsWebAssemblyBasicThemeModule),
typeof(AbpAccountApplicationContractsModule),
typeof(AbpIdentityBlazorWebAssemblyModule), typeof(AbpIdentityBlazorWebAssemblyModule),
typeof(AbpAccountBlazorModule), typeof(AbpTenantManagementBlazorWebAssemblyModule),
typeof(AbpSettingManagementBlazorWebAssemblyModule),
typeof(MyProjectNameBlazorModule) typeof(MyProjectNameBlazorModule)
)] )]
public class MyProjectNameBlazorHostModule : AbpModule public class MyProjectNameBlazorHostModule : AbpModule
@ -52,7 +56,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Host
{ {
Configure<AbpNavigationOptions>(options => Configure<AbpNavigationOptions>(options =>
{ {
options.MenuContributors.Add(new MyProjectNameHostMenuContributor()); options.MenuContributors.Add(new MyProjectNameHostMenuContributor(context.Services.GetConfiguration()));
}); });
} }

@ -1,29 +1,41 @@
using System.Threading.Tasks; using System;
using MyCompanyName.MyProjectName.Localization; using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.UI.Navigation; using Volo.Abp.UI.Navigation;
using Volo.Abp.Account.Localization;
namespace MyCompanyName.MyProjectName.Blazor.Host namespace MyCompanyName.MyProjectName.Blazor.Host
{ {
public class MyProjectNameHostMenuContributor : IMenuContributor public class MyProjectNameHostMenuContributor : IMenuContributor
{ {
public Task ConfigureMenuAsync(MenuConfigurationContext context) private readonly IConfiguration _configuration;
public MyProjectNameHostMenuContributor(IConfiguration configuration)
{
_configuration = configuration;
}
public async Task ConfigureMenuAsync(MenuConfigurationContext context)
{ {
if(context.Menu.DisplayName != StandardMenus.Main) if (context.Menu.Name == StandardMenus.User)
{ {
return Task.CompletedTask; await ConfigureUserMenuAsync(context);
} }
}
private Task ConfigureUserMenuAsync(MenuConfigurationContext context)
{
var accountStringLocalizer = context.GetLocalizer<AccountResource>();
var l = context.GetLocalizer<MyProjectNameResource>(); var identityServerUrl = _configuration["AuthServer:Authority"] ?? "";
context.Menu.Items.Insert( context.Menu.AddItem(new ApplicationMenuItem(
0, "Account.Manage",
new ApplicationMenuItem( accountStringLocalizer["ManageYourProfile"],
"MyProjectName.Home", $"{identityServerUrl.EnsureEndsWith('/')}Account/Manage?returnUrl={_configuration["App:SelfUrl"]}",
l["Menu:Home"], icon: "fa fa-cog",
"/", order: 1000,
icon: "fas fa-home" null).RequireAuthenticated());
)
);
return Task.CompletedTask; return Task.CompletedTask;
} }

@ -1,4 +1,7 @@
{ {
"App": {
"SelfUrl": "https://localhost:44307"
},
"AuthServer": { "AuthServer": {
"Authority": "https://localhost:44301", "Authority": "https://localhost:44301",
"ClientId": "MyProjectName_Blazor", "ClientId": "MyProjectName_Blazor",
@ -6,7 +9,10 @@
}, },
"RemoteServices": { "RemoteServices": {
"Default": { "Default": {
"BaseUrl": "https://localhost:44300" "BaseUrl": "https://localhost:44301/"
} },
} "MyProjectName": {
"BaseUrl": "https://localhost:44300/"
}
}
} }

@ -29,6 +29,8 @@
<ProjectReference Include="..\..\..\..\..\modules\account\src\Volo.Abp.Account.Web.IdentityServer\Volo.Abp.Account.Web.IdentityServer.csproj" /> <ProjectReference Include="..\..\..\..\..\modules\account\src\Volo.Abp.Account.Web.IdentityServer\Volo.Abp.Account.Web.IdentityServer.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\account\src\Volo.Abp.Account.Application\Volo.Abp.Account.Application.csproj" /> <ProjectReference Include="..\..\..\..\..\modules\account\src\Volo.Abp.Account.Application\Volo.Abp.Account.Application.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.EntityFrameworkCore\Volo.Abp.SettingManagement.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.EntityFrameworkCore\Volo.Abp.SettingManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.Application\Volo.Abp.SettingManagement.Application.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.HttpApi\Volo.Abp.SettingManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\audit-logging\src\Volo.Abp.AuditLogging.EntityFrameworkCore\Volo.Abp.AuditLogging.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\..\..\..\modules\audit-logging\src\Volo.Abp.AuditLogging.EntityFrameworkCore\Volo.Abp.AuditLogging.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\identityserver\src\Volo.Abp.IdentityServer.EntityFrameworkCore\Volo.Abp.IdentityServer.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\..\..\..\modules\identityserver\src\Volo.Abp.IdentityServer.EntityFrameworkCore\Volo.Abp.IdentityServer.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.EntityFrameworkCore\Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.EntityFrameworkCore\Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj" />

@ -39,6 +39,7 @@ using Volo.Abp.PermissionManagement;
using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.PermissionManagement.HttpApi; using Volo.Abp.PermissionManagement.HttpApi;
using Volo.Abp.PermissionManagement.Identity; using Volo.Abp.PermissionManagement.Identity;
using Volo.Abp.SettingManagement;
using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.Swashbuckle; using Volo.Abp.Swashbuckle;
using Volo.Abp.TenantManagement; using Volo.Abp.TenantManagement;
@ -67,6 +68,8 @@ namespace MyCompanyName.MyProjectName
typeof(AbpPermissionManagementApplicationModule), typeof(AbpPermissionManagementApplicationModule),
typeof(AbpPermissionManagementHttpApiModule), typeof(AbpPermissionManagementHttpApiModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementApplicationModule),
typeof(AbpSettingManagementHttpApiModule),
typeof(AbpFeatureManagementEntityFrameworkCoreModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule),
typeof(AbpFeatureManagementApplicationModule), typeof(AbpFeatureManagementApplicationModule),
typeof(AbpFeatureManagementHttpApiModule), typeof(AbpFeatureManagementHttpApiModule),
@ -105,7 +108,7 @@ namespace MyCompanyName.MyProjectName
options.Languages.Add(new LanguageInfo("cs", "cs", "Čeština")); options.Languages.Add(new LanguageInfo("cs", "cs", "Čeština"));
options.Languages.Add(new LanguageInfo("en", "en", "English")); options.Languages.Add(new LanguageInfo("en", "en", "English"));
options.Languages.Add(new LanguageInfo("en-GB", "en-GB", "English (UK)")); options.Languages.Add(new LanguageInfo("en-GB", "en-GB", "English (UK)"));
options.Languages.Add(new LanguageInfo("fi", "fi", "Finnish")); options.Languages.Add(new LanguageInfo("fi", "fi", "Finnish"));
options.Languages.Add(new LanguageInfo("fr", "fr", "Français")); options.Languages.Add(new LanguageInfo("fr", "fr", "Français"));
options.Languages.Add(new LanguageInfo("hi", "hi", "Hindi", "in")); options.Languages.Add(new LanguageInfo("hi", "hi", "Hindi", "in"));
options.Languages.Add(new LanguageInfo("it", "it", "Italian", "it")); options.Languages.Add(new LanguageInfo("it", "it", "Italian", "it"));

Loading…
Cancel
Save