Setting management web page initial version

pull/625/head
Halil ibrahim Kalkan 6 years ago
parent 5a1c67a554
commit 39d2b6c685

@ -1,5 +1,8 @@
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.Modularity;
using Volo.Abp.SettingManagement.Web.Navigation;
using Volo.Abp.UI.Navigation;
using Volo.Abp.VirtualFileSystem;
namespace Volo.Abp.SettingManagement.Web
{
@ -8,6 +11,17 @@ namespace Volo.Abp.SettingManagement.Web
)]
public class AbpSettingManagementWebModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<NavigationOptions>(options =>
{
options.MenuContributors.Add(new SettingManagementMainMenuContributor());
});
Configure<VirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<AbpSettingManagementWebModule>("Volo.Abp.SettingManagement.Web");
});
}
}
}

@ -0,0 +1,33 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.SettingManagement.Web.Pages.SettingManagement;
using Volo.Abp.UI.Navigation;
namespace Volo.Abp.SettingManagement.Web.Navigation
{
public class SettingManagementMainMenuContributor : IMenuContributor
{
public Task ConfigureMenuAsync(MenuConfigurationContext context)
{
if (context.Menu.Name != StandardMenus.Main)
{
return Task.CompletedTask;
}
var settingManagementPageOptions = context.ServiceProvider.GetRequiredService<IOptions<SettingManagementPageOptions>>().Value;
if (!settingManagementPageOptions.Contributors.Any())
{
return Task.CompletedTask;
}
//TODO: Localize
//var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<IdentityResource>>();
context.Menu.AddItem(new ApplicationMenuItem("Volo.Abp.SettingManagement", "Settings", "/SettingManagement", icon: "fa fa-cog", order: int.MaxValue - 1000));
return Task.CompletedTask;
}
}
}

@ -1,3 +1,4 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
@ -9,15 +10,19 @@ namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement
public SettingPageCreationContext SettingPageCreationContext { get; private set; }
private readonly SettingManagementPageOptions _options;
private readonly IServiceProvider _serviceProvider;
public IndexModel(IOptions<SettingManagementPageOptions> options)
public IndexModel(
IOptions<SettingManagementPageOptions> options,
IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
_options = options.Value;
}
public async Task OnGetAsync()
{
SettingPageCreationContext = new SettingPageCreationContext();
SettingPageCreationContext = new SettingPageCreationContext(_serviceProvider);
foreach (var contributor in _options.Contributors)
{

@ -1,13 +1,19 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement
{
public class SettingPageCreationContext
public class SettingPageCreationContext : IServiceProviderAccessor
{
public IServiceProvider ServiceProvider { get; }
public List<SettingPageGroup> Groups { get; }
public SettingPageCreationContext()
public SettingPageCreationContext(IServiceProvider serviceProvider)
{
ServiceProvider = serviceProvider;
Groups = new List<SettingPageGroup>();
}
}

@ -10,4 +10,19 @@
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\**\*.*" Exclude="*.cs" />
<EmbeddedResource Include="Localization\Resources\**\*.json" />
</ItemGroup>
<ItemGroup>
<Content Remove="Pages\**\*.cshtml" />
<Content Remove="Pages\**\*.js" />
<Content Remove="Pages\**\*.css" />
<Content Remove="Localization\Resources\**\*.json" />
<Content Remove="Properties\launchSettings.json" />
<None Remove="Pages\Identity\Shared\personal-settings-modal.js" />
<None Include="Properties\launchSettings.json" />
</ItemGroup>
</Project>

Loading…
Cancel
Save