Skip to content

Commit 5567412

Browse files
committed
Menu system changed to ABP's system for durandal.
1 parent e9ab4b3 commit 5567412

File tree

2 files changed

+9
-8
lines changed
  • Templates/All-In-One-Template/MySpaProject/MySpaProject.WebSpaDurandal/App/Main

2 files changed

+9
-8
lines changed

Templates/All-In-One-Template/MySpaProject/MySpaProject.WebSpaDurandal/App/Main/viewmodels/layout.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
that.languages = abp.localization.languages;
1010
that.currentLanguage = abp.localization.currentLanguage;
1111

12+
that.menu = abp.nav.menus.MainMenu;
13+
1214
that.activate = function () {
1315
router.map([
14-
{ route: '', title: abp.localization.localize('HomePage', 'MySpaProject'), moduleId: 'viewmodels/home', nav: true },
15-
{ route: 'about', title: abp.localization.localize('About', 'MySpaProject'), moduleId: 'viewmodels/about', nav: true }
16+
{ route: '', title: abp.localization.localize('HomePage', 'MySpaProject'), moduleId: 'viewmodels/home', nav: true, menuName: 'Home' },
17+
{ route: 'about', title: abp.localization.localize('About', 'MySpaProject'), moduleId: 'viewmodels/about', nav: true, menuName: 'About' }
1618
]).buildNavigationModel();
1719

1820
return that.router.activate();

Templates/All-In-One-Template/MySpaProject/MySpaProject.WebSpaDurandal/App/Main/views/layout.cshtml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
<a class="navbar-brand" href="#">MySpaProject!</a>
1111
</div>
1212
<div class="collapse navbar-collapse">
13-
<ul class="nav navbar-nav" data-bind="foreach: router.navigationModel">
14-
<li data-bind="css: { active: isActive }">
15-
<a data-bind="attr: { href: hash }, html: title"></a>
13+
<ul class="nav navbar-nav" data-bind="foreach: menu.items">
14+
<li data-bind="css: { active: $root.router.activeInstruction().config.menuName == name }">
15+
<a href="{{url}}"><i class="{{icon}}"></i> {{displayName}}</a>
1616
</li>
1717
</ul>
1818
<ul class="nav navbar-nav navbar-right">
1919
<li class="dropdown">
2020
<a href="" data-toggle="dropdown"><i class="{{currentLanguage.icon}}"></i> <span>{{currentLanguage.displayName}}</span> <b class="caret"></b></a>
2121
<ul class="dropdown-menu" data-bind="foreach: languages">
22-
<li data-bind="visible: $parent.currentLanguage.name != name"><a href="{{'/AbpLocalization/ChangeCulture?cultureName=' + name}}"><i class="{{icon}}"></i> {{displayName}}</a></li>
22+
<li data-bind="visible: $root.currentLanguage.name != name"><a href="{{'/AbpLocalization/ChangeCulture?cultureName=' + name}}"><i class="{{icon}}"></i> {{displayName}}</a></li>
2323
</ul>
2424
</li>
2525
</ul>
@@ -29,5 +29,4 @@
2929

3030
<div class="container">
3131
<div data-bind="router: { transition: 'entrance' }"></div>
32-
</div>
33-
32+
</div>

0 commit comments

Comments
 (0)