File tree Expand file tree Collapse file tree 8 files changed +65
-12
lines changed
AbpCompanyName.AbpProjectName.WebMpa
AbpCompanyName.AbpProjectName.WebSpaAngular Expand file tree Collapse file tree 8 files changed +65
-12
lines changed Original file line number Diff line number Diff line change 449449 <Compile Include =" Models\Layout\TopMenuViewModel.cs" />
450450 <Compile Include =" Properties\AssemblyInfo.cs" />
451451 <Compile Include =" Views\AbpProjectNameWebViewPageBase.cs" />
452+ <Compile Include =" Views\UrlChecker.cs" />
452453 </ItemGroup >
453454 <ItemGroup >
454455 <Content Include =" Views\web.config" />
Original file line number Diff line number Diff line change @@ -19,31 +19,31 @@ public override void SetNavigation(INavigationProviderContext context)
1919 new MenuItemDefinition (
2020 "Home" ,
2121 L ( "HomePage" ) ,
22- url : "/ " ,
22+ url : "" ,
2323 icon : "fa fa-home" ,
2424 requiresAuthentication : true
2525 )
2626 ) . AddItem (
2727 new MenuItemDefinition (
2828 "Tenants" ,
2929 L ( "Tenants" ) ,
30- url : "/ Tenants" ,
30+ url : "Tenants" ,
3131 icon : "fa fa-globe" ,
3232 requiredPermissionName : PermissionNames . Pages_Tenants
3333 )
3434 ) . AddItem (
3535 new MenuItemDefinition (
3636 "Users" ,
3737 L ( "Users" ) ,
38- url : "/ Users" ,
38+ url : "Users" ,
3939 icon : "fa fa-users" ,
4040 requiredPermissionName : PermissionNames . Pages_Users
4141 )
4242 ) . AddItem (
4343 new MenuItemDefinition (
4444 "About" ,
4545 L ( "About" ) ,
46- url : "/ About" ,
46+ url : "About" ,
4747 icon : "fa fa-info"
4848 )
4949 ) ;
Original file line number Diff line number Diff line change 11@using Abp .Collections .Extensions
2+ @using AbpCompanyName .AbpProjectName .WebMpa .Views
23@model AbpCompanyName .AbpProjectName .WebMpa .Models .Layout .TopMenuViewModel
4+ @{
5+ var calculateMenuUrl = new Func <string , string >((url ) =>
6+ {
7+ if (string .IsNullOrEmpty (url ))
8+ {
9+ return ApplicationPath ;
10+ }
11+
12+ if (UrlChecker .IsRooted (url ))
13+ {
14+ return url ;
15+ }
16+
17+ return ApplicationPath + url ;
18+ });
19+ }
320@foreach ( var menuItem in Model .MainMenu .Items )
421{
522 <li class =" @(Model.ActiveMenuItemName == menuItem.Name ? " active " : " " )" >
623 @if (menuItem .Items .IsNullOrEmpty ())
724 {
8- <a href =" @menuItem.Url" >
25+ <a href =" @calculateMenuUrl( menuItem.Url) " >
926 @if (! string .IsNullOrWhiteSpace (menuItem .Icon ))
1027 {
1128 <i class =" @menuItem.Icon" ></i >
2643 @foreach ( var subMenuItem in menuItem .Items )
2744 {
2845 <li >
29- <a href =" @subMenuItem.Url" >
46+ <a href =" @calculateMenuUrl( subMenuItem.Url) " >
3047 @if (! string .IsNullOrWhiteSpace (subMenuItem .Icon ))
3148 {
3249 <i class =" @subMenuItem.Icon" ></i >
Original file line number Diff line number Diff line change 1+ using System . Text . RegularExpressions ;
2+
3+ namespace AbpCompanyName . AbpProjectName . WebMpa . Views
4+ {
5+ public static class UrlChecker
6+ {
7+ private static readonly Regex UrlWithProtocolRegex = new Regex ( "^.{1,10}://.*$" ) ;
8+
9+ public static bool IsRooted ( string url )
10+ {
11+ if ( url . StartsWith ( "/" ) )
12+ {
13+ return true ;
14+ }
15+
16+ if ( UrlWithProtocolRegex . IsMatch ( url ) )
17+ {
18+ return true ;
19+ }
20+
21+ return false ;
22+ }
23+ }
24+ }
Original file line number Diff line number Diff line change 11( function ( $ ) {
22
3- if ( ! $ ) {
4- return ;
5- }
6-
3+ //Notification handler
74 abp . event . on ( 'abp.notifications.received' , function ( userNotification ) {
8- console . log ( userNotification ) ;
5+ abp . notifications . showUiNotifyForUserNotification ( userNotification ) ;
96 } ) ;
107
8+ //serializeFormToObject plugin for jQuery
119 $ . fn . serializeFormToObject = function ( ) {
1210 //serialize to array
1311 var data = $ ( this ) . serializeArray ( ) ;
2422 return obj ;
2523 }
2624
25+ //Configure blockUI
26+ ( function ( $ ) {
27+ if ( $ . blockUI ) {
28+ $ . blockUI . defaults . baseZ = 2000 ;
29+ }
30+ } ) ( jQuery ) ;
31+
2732} ) ( jQuery ) ;
Original file line number Diff line number Diff line change 310310 <Content Include =" App\Main\views\users\index.js" />
311311 <Content Include =" App\Main\views\tenants\createModal.js" />
312312 <Content Include =" App\Main\views\tenants\index.js" />
313+ <Content Include =" App\Main\_libconfig.js" />
313314 <Content Include =" Common\Scripts\helpers.js" />
314315 <Content Include =" Content\bootstrap-cosmo.min.css" />
315316 <Content Include =" Content\bootstrap-theme.css" />
Original file line number Diff line number Diff line change 1+ ( function ( $ ) {
2+ if ( $ . blockUI ) {
3+ $ . blockUI . defaults . baseZ = 2000 ;
4+ }
5+ } ) ( jQuery ) ;
Original file line number Diff line number Diff line change 2828 } ;
2929
3030 abp . event . on ( 'abp.notifications.received' , function ( userNotification ) {
31- console . log ( userNotification ) ;
31+ abp . notifications . showUiNotifyForUserNotification ( userNotification ) ;
3232 } ) ;
3333 }
3434 ] ) ;
You can’t perform that action at this time.
0 commit comments