Skip to content

Commit f3e71c9

Browse files
Merge pull request #747 from dtaylor113/vert-nav-items-mobile-only
fix(pfVerticalNavigation): on mobile, move the masthead utility items to the vertical navigation
2 parents bcf6d0d + fb4ffeb commit f3e71c9

File tree

3 files changed

+66
-6
lines changed

3 files changed

+66
-6
lines changed

src/navigation/examples/vertical-navigation-basic.js

+16-4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
* <li>.tooltip - (string) Tooltip to display for the badge
3636
* <li>.badgeClass: - (string) Additional class(es) to add to the badge container
3737
* </ul>
38+
* <li>.mobileOnly - (boolean) When set to 'true', menu item will only be displayed when browser is in mobile mode (<768px).
39+
* When <code>ignoreMobile</code> flag set to 'true', <code>mobileOnly</code> items are not displayed.
3840
* </ul>
3941
* @param {function} navigateCallback function(item) Callback method invoked on a navigation item click (one with no submenus)
4042
* @param {function} itemClickCallback function(item) Callback method invoked on an item click
@@ -76,7 +78,7 @@
7678
<span class="caret"></span>
7779
</a>
7880
<ul class="dropdown-menu" aria-labelledby="dropdownMenu2">
79-
<li><a href="#">Preferences</a></li>
81+
<li><a href="#">User Preferences</a></li>
8082
<li><a href="#">Logout</a></li>
8183
</ul>
8284
</li>
@@ -392,9 +394,19 @@
392394
href: "#/adipscing"
393395
},
394396
{
395-
title: "Lorem",
396-
iconClass: "fa fa-gamepad",
397-
href: "#/lorem"
397+
title: "Help",
398+
iconClass: "fa pficon-help",
399+
href: "#/help",
400+
mobileOnly: true
401+
},
402+
{
403+
title: "User",
404+
iconClass: "fa pficon-user",
405+
mobileOnly: true,
406+
children: [
407+
{ title: "User Preferences" },
408+
{ title: "Logout" }
409+
]
398410
},
399411
{
400412
title: "Exit Demo"

src/navigation/examples/vertical-navigation-router.js

+48-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
* </ul>
2727
* <li>.uiSref - (string) Optional Angular UI Router state name. If specified, href must be not defined, and vice versa.
2828
* <li>.uiSrefOptions - (object) Optional object to be passed to Angular UI Router $state.go() function
29+
* <li>.mobileOnly - (boolean) When set to 'true', menu item will only be displayed when browser is in mobile mode (<768px).
30+
* When <code>ignoreMobile</code> flag set to 'true', <code>mobileOnly</code> items are not displayed.
2931
* </ul>
3032
* @param {function} navigateCallback function(item) Callback method invoked on a navigation item click (one with no submenus)
3133
* @param {function} itemClickCallback function(item) Callback method invoked on an item click
@@ -67,7 +69,7 @@
6769
<span class="caret"></span>
6870
</a>
6971
<ul class="dropdown-menu" aria-labelledby="dropdownMenu2">
70-
<li><a href="#">Preferences</a></li>
72+
<li><a href="#">User Preferences</a></li>
7173
<li><a href="#">Logout</a></li>
7274
</ul>
7375
</li>
@@ -125,6 +127,36 @@
125127
</p>\
126128
</div>\
127129
</div>'
130+
})
131+
.state('help', {
132+
url: '/help',
133+
template: '<div class="card-pf card-pf-accented card-pf-aggregate-status" style="height: 89px;">\
134+
<div class="card-pf-body" style="height: 50px;">\
135+
<p class="card-pf-aggregate-status-notifications">\
136+
State: Help\
137+
</p>\
138+
</div>\
139+
</div>'
140+
})
141+
.state('user-prefs', {
142+
url: '/help',
143+
template: '<div class="card-pf card-pf-accented card-pf-aggregate-status" style="height: 89px;">\
144+
<div class="card-pf-body" style="height: 50px;">\
145+
<p class="card-pf-aggregate-status-notifications">\
146+
State: User Preferences\
147+
</p>\
148+
</div>\
149+
</div>'
150+
})
151+
.state('logout', {
152+
url: '/help',
153+
template: '<div class="card-pf card-pf-accented card-pf-aggregate-status" style="height: 89px;">\
154+
<div class="card-pf-body" style="height: 50px;">\
155+
<p class="card-pf-aggregate-status-notifications">\
156+
State: Logout\
157+
</p>\
158+
</div>\
159+
</div>'
128160
});
129161
})
130162
.controller('vertNavWithRouterController', ['$scope',
@@ -146,6 +178,21 @@
146178
iconClass : "fa fa-space-shuttle",
147179
uiSref: "ipsum"
148180
},
181+
{
182+
title: "Help",
183+
iconClass: "fa pficon-help",
184+
uiSref: "help",
185+
mobileOnly: true
186+
},
187+
{
188+
title: "User",
189+
iconClass: "fa pficon-user",
190+
mobileOnly: true,
191+
children: [
192+
{ title: "User Preferences", uiSref: "user-prefs" },
193+
{ title: "Logout", uiSref: "logout" }
194+
]
195+
},
149196
{
150197
title: "Exit Demo"
151198
}

src/navigation/vertical-navigation.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
'active': item.isActive,
3636
'is-hover': item.isHover,
3737
'mobile-nav-item-pf': item.isMobileItem && $ctrl.showMobileSecondary,
38-
'mobile-secondary-item-pf': item.isMobileItem && $ctrl.showMobileTertiary}"
38+
'mobile-secondary-item-pf': item.isMobileItem && $ctrl.showMobileTertiary,
39+
'visible-xs': item.mobileOnly}"
3940
ng-mouseenter="$ctrl.handlePrimaryHover(item)" ng-mouseleave="$ctrl.handlePrimaryUnHover(item)">
4041
<a ng-click="$ctrl.handlePrimaryClick(item, $event)">
4142
<span class="{{item.iconClass}}" ng-if="item.iconClass" ng-class="{hidden: $ctrl.hiddenIcons}"

0 commit comments

Comments
 (0)