Skip to content

Commit 112adaa

Browse files
committed
Adapting ABP menu system.
1 parent 0542010 commit 112adaa

File tree

9 files changed

+60
-10
lines changed

9 files changed

+60
-10
lines changed

Templates/All-In-One-Template/MySpaProject/MySpaProject.Core/MySpaProject.Core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<Reference Include="System.Xml" />
6161
</ItemGroup>
6262
<ItemGroup>
63+
<Compile Include="MySpaProjectConsts.cs" />
6364
<Compile Include="MySpaProjectCoreModule.cs" />
6465
<Compile Include="Properties\AssemblyInfo.cs" />
6566
</ItemGroup>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace MySpaProject
2+
{
3+
public class MySpaProjectConsts
4+
{
5+
public const string LocalizationSourceName = "MySpaProject";
6+
}
7+
}

Templates/All-In-One-Template/MySpaProject/MySpaProject.Core/MySpaProjectCoreModule.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
using System.Reflection;
2-
using Abp.Localization;
32
using Abp.Modules;
43

54
namespace MySpaProject
65
{
76
public class MySpaProjectCoreModule : AbpModule
87
{
9-
public override void PreInitialize()
10-
{
11-
Configuration.Localization.Languages.Add(new LanguageInfo("en", "English", "famfamfam-flag-england", true));
12-
Configuration.Localization.Languages.Add(new LanguageInfo("tr", "Türkçe", "famfamfam-flag-tr"));
13-
}
14-
158
public override void Initialize()
169
{
1710
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());

Templates/All-In-One-Template/MySpaProject/MySpaProject.WebMpa/App_Start/MySpaProjectWebModule.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Web;
33
using System.Web.Mvc;
44
using System.Web.Routing;
5+
using Abp.Localization;
56
using Abp.Localization.Sources.Xml;
67
using Abp.Modules;
78

@@ -10,6 +11,12 @@ namespace MySpaProject.WebMpa
1011
[DependsOn(typeof(MySpaProjectDataModule), typeof(MySpaProjectApplicationModule), typeof(MySpaProjectWebApiModule))]
1112
public class MySpaProjectWebModule : AbpModule
1213
{
14+
public override void PreInitialize()
15+
{
16+
Configuration.Localization.Languages.Add(new LanguageInfo("en", "English", "famfamfam-flag-england", true));
17+
Configuration.Localization.Languages.Add(new LanguageInfo("tr", "Türkçe", "famfamfam-flag-tr"));
18+
}
19+
1320
public override void Initialize()
1421
{
1522
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using Abp.Application.Navigation;
2+
using Abp.Localization;
3+
4+
namespace MySpaProject.WebSpaAngular
5+
{
6+
public class MySpaProjectNavigationProvider : INavigationProvider
7+
{
8+
public void SetNavigation(INavigationProviderContext context)
9+
{
10+
context.Manager.MainMenu
11+
.AddItem(
12+
new MenuItemDefinition(
13+
"Home",
14+
new LocalizableString("HomePage", MySpaProjectConsts.LocalizationSourceName)
15+
)
16+
).AddItem(
17+
new MenuItemDefinition(
18+
"About",
19+
new LocalizableString("About", MySpaProjectConsts.LocalizationSourceName)
20+
)
21+
);
22+
}
23+
}
24+
}

Templates/All-In-One-Template/MySpaProject/MySpaProject.WebSpaAngular/App_Start/MySpaProjectWebModule.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Web;
33
using System.Web.Mvc;
44
using System.Web.Routing;
5+
using Abp.Localization;
56
using Abp.Localization.Sources.Xml;
67
using Abp.Modules;
78

@@ -10,13 +11,21 @@ namespace MySpaProject.WebSpaAngular
1011
[DependsOn(typeof(MySpaProjectDataModule), typeof(MySpaProjectApplicationModule), typeof(MySpaProjectWebApiModule))]
1112
public class MySpaProjectWebModule : AbpModule
1213
{
14+
public override void PreInitialize()
15+
{
16+
Configuration.Localization.Languages.Add(new LanguageInfo("en", "English", "famfamfam-flag-england", true));
17+
Configuration.Localization.Languages.Add(new LanguageInfo("tr", "Türkçe", "famfamfam-flag-tr"));
18+
19+
Configuration.Navigation.Providers.Add<MySpaProjectNavigationProvider>();
20+
}
21+
1322
public override void Initialize()
1423
{
1524
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
1625

1726
Configuration.Localization.Sources.Add(
1827
new XmlLocalizationSource(
19-
"MySpaProject",
28+
MySpaProjectConsts.LocalizationSourceName,
2029
HttpContext.Current.Server.MapPath("~/Localization/MySpaProject")
2130
)
2231
);

Templates/All-In-One-Template/MySpaProject/MySpaProject.WebSpaAngular/MySpaProject.WebSpaAngular.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,7 @@
10561056
<Content Include="Views\Shared\_Layout.cshtml" />
10571057
</ItemGroup>
10581058
<ItemGroup>
1059+
<Compile Include="App_Start\MySpaProjectNavigationProvider.cs" />
10591060
<Compile Include="App_Start\MySpaProjectWebModule.cs" />
10601061
<Compile Include="App_Start\RouteConfig.cs" />
10611062
<Compile Include="Controllers\HomeController.cs" />

Templates/All-In-One-Template/MySpaProject/MySpaProject.WebSpaAngular/Views/Shared/_Layout.cshtml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<!-- Windows Phone 8 and Internet Explorer 10 FIX -->
4747
<script src="~/Abp/Framework/scripts/utils/ie10fix.js"></script>
4848

49-
<!-- Modernizr: for feature detection (All other scripts are included at the end of file for faster page load) -->
49+
<!-- Modernizr -->
5050
<script src="~/Scripts/modernizr-2.8.3.js"></script>
5151

5252
<!-- jQuery and plugins -->
@@ -68,8 +68,9 @@
6868
<script src="~/Abp/Framework/scripts/libs/abp.blockUI.js"></script>
6969
<script src="~/Abp/Framework/scripts/libs/abp.spin.js"></script>
7070

71-
<!-- Dynamic script for client side localization (It's created on runtime) -->
71+
<!-- Dynamic script of ABP system (It's created on runtime) -->
7272
<script src="~/AbpLocalization/GetScripts" type="text/javascript"></script>
73+
<script src="~/AbpNavigation/GetScripts" type="text/javascript"></script>
7374

7475
<!-- Custom scripts for views -->
7576
@RenderSection("scripts", required: false)

Templates/All-In-One-Template/MySpaProject/MySpaProject.WebSpaDurandal/App_Start/MySpaProjectWebModule.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Web;
33
using System.Web.Mvc;
44
using System.Web.Routing;
5+
using Abp.Localization;
56
using Abp.Localization.Sources.Xml;
67
using Abp.Modules;
78

@@ -10,6 +11,12 @@ namespace MySpaProject.WebSpaDurandal
1011
[DependsOn(typeof(MySpaProjectDataModule),typeof(MySpaProjectApplicationModule),typeof(MySpaProjectWebApiModule))]
1112
public class MySpaProjectWebModule : AbpModule
1213
{
14+
public override void PreInitialize()
15+
{
16+
Configuration.Localization.Languages.Add(new LanguageInfo("en", "English", "famfamfam-flag-england", true));
17+
Configuration.Localization.Languages.Add(new LanguageInfo("tr", "Türkçe", "famfamfam-flag-tr"));
18+
}
19+
1320
public override void Initialize()
1421
{
1522
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());

0 commit comments

Comments
 (0)