File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 1
1
@using AbpCompanyName .AbpProjectName .Web .Views .Shared .Components .SideBarMenu
2
2
@model SideBarMenuViewModel
3
+ @{
4
+ var orderedMenuItems = Model .MainMenu .Items .Where (x => x .IsVisible ).OrderByCustom ().ToList ();
5
+ }
6
+
3
7
<nav class =" mt-2" >
4
8
<ul class =" nav nav-pills nav-sidebar flex-column nav-flat" data-widget =" treeview" role =" menu" data-accordion =" false" >
5
9
@{
6
- foreach (var item in Model . MainMenu . Items . Where ( x => x . IsVisible ) )
10
+ foreach (var item in orderedMenuItems )
7
11
{
8
12
@await Html .PartialAsync (" Components/SideBarMenu/_MenuItem" , item )
9
13
}
Original file line number Diff line number Diff line change
1
+ using Abp . Application . Navigation ;
2
+ using System . Collections . Generic ;
3
+ using System . Linq ;
4
+
5
+ namespace AbpCompanyName . AbpProjectName . Web . Views . Shared . Components . SideBarMenu
6
+ {
7
+ public static class UserMenuItemExtensions
8
+ {
9
+ public static IOrderedEnumerable < UserMenuItem > OrderByCustom ( this IEnumerable < UserMenuItem > menuItems )
10
+ {
11
+ return menuItems
12
+ . OrderBy ( menuItem => menuItem . Order )
13
+ . ThenBy ( menuItem => menuItem . DisplayName ) ;
14
+ }
15
+ }
16
+ }
Original file line number Diff line number Diff line change 1
1
@using AbpCompanyName .AbpProjectName .Web .Views
2
+ @using AbpCompanyName .AbpProjectName .Web .Views .Shared .Components .SideBarMenu
2
3
@using Abp .Application .Navigation
3
4
@model Abp .Application .Navigation .UserMenuItem
4
5
@inject ILanguageManager LanguageManager
5
6
@{
6
7
var isActive = IsActiveMenuItem (Model , ViewBag .CurrentPageName );
7
- var subMenus = Model .Items .Where (x => x .IsVisible ).ToList ();
8
+ var subMenus = Model .Items .Where (x => x .IsVisible ).OrderByCustom (). ToList ();
8
9
var hasSubMenus = subMenus .Any ();
9
10
}
10
11
@functions {
You can’t perform that action at this time.
0 commit comments