-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename ConfigureDynamicMenu to ConfigureAbpDynamicMenu.
Added a host demo data seeder. Fix a bug of url override. Restrict a menu item to have 2 levels of submenu items. Support deleting parent menu items. Update README.md.
- Loading branch information
Showing
21 changed files
with
176 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,43 @@ | ||
# Abp.DynamicMenu | ||
|
||
[](https://abp.io) | ||
[](https://www.nuget.org/packages/EasyAbp.Abp.DynamicMenu.Domain.Shared) | ||
[](https://www.nuget.org/packages/EasyAbp.Abp.DynamicMenu.Domain.Shared) | ||
[](https://www.github.com/EasyAbp/Abp.DynamicMenu) | ||
|
||
An abp module that dynamically creates menu items for ABP UI projects in runtime. | ||
|
||
## Online Demo | ||
|
||
We have launched an online demo for this module: [https://dynamicmenu.samples.easyabp.io](https://dynamicmenu.samples.easyabp.io) | ||
|
||
 | ||
|
||
## Installation | ||
|
||
1. Install the following NuGet packages. ([see how](https://github.com/EasyAbp/EasyAbpGuide/blob/master/docs/How-To.md#add-nuget-packages)) | ||
|
||
* EasyAbp.Abp.DynamicMenu.Application | ||
* EasyAbp.Abp.DynamicMenu.Application.Contracts | ||
* EasyAbp.Abp.DynamicMenu.Domain | ||
* EasyAbp.Abp.DynamicMenu.Domain.Shared | ||
* EasyAbp.Abp.DynamicMenu.EntityFrameworkCore | ||
* EasyAbp.Abp.DynamicMenu.HttpApi | ||
* EasyAbp.Abp.DynamicMenu.HttpApi.Client | ||
* EasyAbp.Abp.DynamicMenu.Web | ||
|
||
1. Add `DependsOn(typeof(AbpDynamicMenuXxxModule))` attribute to configure the module dependencies. ([see how](https://github.com/EasyAbp/EasyAbpGuide/blob/master/docs/How-To.md#add-module-dependencies)) | ||
|
||
1. Add `builder.ConfigureAbpDynamicMenu();` to the `OnModelCreating()` method in **MyProjectMigrationsDbContext.cs**. | ||
|
||
1. Add EF Core migrations and update your database. See: [ABP document](https://docs.abp.io/en/abp/latest/Tutorials/Part-1?UI=MVC&DB=EF#add-database-migration). | ||
|
||
## Usage | ||
|
||
1. Create a dynamic menu item on the management page. | ||
|
||
2. Refresh the page and you can see the menu item you just created. | ||
|
||
## Road map | ||
|
||
- [ ] More customizable options for menu items. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
host/EasyAbp.Abp.DynamicMenu.Host.Shared/DemoDataSeedContributor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using EasyAbp.Abp.DynamicMenu.MenuItems; | ||
using Volo.Abp.Data; | ||
using Volo.Abp.DependencyInjection; | ||
using Volo.Abp.Uow; | ||
|
||
namespace EasyAbp.Abp.DynamicMenu | ||
{ | ||
public class DemoDataSeedContributor : IDataSeedContributor, ITransientDependency | ||
{ | ||
private readonly IMenuItemRepository _menuItemRepository; | ||
|
||
public DemoDataSeedContributor(IMenuItemRepository menuItemRepository) | ||
{ | ||
_menuItemRepository = menuItemRepository; | ||
} | ||
|
||
[UnitOfWork] | ||
public async Task SeedAsync(DataSeedContext context) | ||
{ | ||
if (await _menuItemRepository.FindAsync(x => x.Name == "DemoMenu") != null) | ||
{ | ||
return; | ||
} | ||
|
||
var subItems = new List<MenuItem> | ||
{ | ||
new("DemoMenu", "ChangePassword", "Change password", "~/Account/Manage", null, null, null, null, | ||
DynamicMenuConsts.DefaultLResourceTypeName, DynamicMenuConsts.DefaultLResourceTypeAssemblyName, | ||
null) | ||
}; | ||
|
||
var demoMenu = new MenuItem(null, "DemoMenu", "Demo menu", null, null, null, null, null, | ||
DynamicMenuConsts.DefaultLResourceTypeName, DynamicMenuConsts.DefaultLResourceTypeAssemblyName, subItems); | ||
|
||
await _menuItemRepository.InsertAsync(demoMenu, true); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
host/EasyAbp.Abp.DynamicMenu.Host.Shared/DynamicMenuHostSharedModule.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using EasyAbp.Abp.DynamicMenu.EntityFrameworkCore; | ||
using Volo.Abp.Modularity; | ||
|
||
namespace EasyAbp.Abp.DynamicMenu | ||
{ | ||
[DependsOn( | ||
typeof(DynamicMenuEntityFrameworkCoreModule), | ||
typeof(DynamicMenuApplicationModule) | ||
)] | ||
public class DynamicMenuHostSharedModule : AbpModule | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...amicMenu.Application/EasyAbp/Abp/DynamicMenu/MenuItems/ExceededMenuLevelLimitException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Volo.Abp; | ||
|
||
namespace EasyAbp.Abp.DynamicMenu.MenuItems | ||
{ | ||
public sealed class ExceededMenuLevelLimitException : BusinessException | ||
{ | ||
public ExceededMenuLevelLimitException(int maxLevel) | ||
: base("EasyAbp.Abp.DynamicMenu:ExceededMenuLevelLimit") | ||
{ | ||
Data["MaxLevel"] = maxLevel; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters