From fb4ffebe6444bce18a9a76054a750bcb5fdd20b4 Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Thu, 14 Jun 2018 16:37:29 -0400
Subject: [PATCH] fix(pfVerticalNavigation): Added mobileOnly property to nav.
item objects; when 'true' items only display in mobile mode.
---
.../examples/vertical-navigation-basic.js | 20 ++++++--
.../examples/vertical-navigation-router.js | 49 ++++++++++++++++++-
src/navigation/vertical-navigation.html | 3 +-
3 files changed, 66 insertions(+), 6 deletions(-)
diff --git a/src/navigation/examples/vertical-navigation-basic.js b/src/navigation/examples/vertical-navigation-basic.js
index 7eb833d3b..b3d8e9fc3 100644
--- a/src/navigation/examples/vertical-navigation-basic.js
+++ b/src/navigation/examples/vertical-navigation-basic.js
@@ -35,6 +35,8 @@
* .tooltip - (string) Tooltip to display for the badge
* .badgeClass: - (string) Additional class(es) to add to the badge container
*
+ * .mobileOnly - (boolean) When set to 'true', menu item will only be displayed when browser is in mobile mode (<768px).
+ * When ignoreMobile
flag set to 'true', mobileOnly
items are not displayed.
*
* @param {function} navigateCallback function(item) Callback method invoked on a navigation item click (one with no submenus)
* @param {function} itemClickCallback function(item) Callback method invoked on an item click
@@ -76,7 +78,7 @@
@@ -392,9 +394,19 @@
href: "#/adipscing"
},
{
- title: "Lorem",
- iconClass: "fa fa-gamepad",
- href: "#/lorem"
+ title: "Help",
+ iconClass: "fa pficon-help",
+ href: "#/help",
+ mobileOnly: true
+ },
+ {
+ title: "User",
+ iconClass: "fa pficon-user",
+ mobileOnly: true,
+ children: [
+ { title: "User Preferences" },
+ { title: "Logout" }
+ ]
},
{
title: "Exit Demo"
diff --git a/src/navigation/examples/vertical-navigation-router.js b/src/navigation/examples/vertical-navigation-router.js
index 68630eff2..fc8544aad 100644
--- a/src/navigation/examples/vertical-navigation-router.js
+++ b/src/navigation/examples/vertical-navigation-router.js
@@ -26,6 +26,8 @@
*
* .uiSref - (string) Optional Angular UI Router state name. If specified, href must be not defined, and vice versa.
* .uiSrefOptions - (object) Optional object to be passed to Angular UI Router $state.go() function
+ * .mobileOnly - (boolean) When set to 'true', menu item will only be displayed when browser is in mobile mode (<768px).
+ * When ignoreMobile
flag set to 'true', mobileOnly
items are not displayed.
*
* @param {function} navigateCallback function(item) Callback method invoked on a navigation item click (one with no submenus)
* @param {function} itemClickCallback function(item) Callback method invoked on an item click
@@ -67,7 +69,7 @@
@@ -125,6 +127,36 @@
\
\
'
+ })
+ .state('help', {
+ url: '/help',
+ template: '\
+
\
+
\
+ State: Help\
+
\
+
\
+
'
+ })
+ .state('user-prefs', {
+ url: '/help',
+ template: '\
+
\
+
\
+ State: User Preferences\
+
\
+
\
+
'
+ })
+ .state('logout', {
+ url: '/help',
+ template: '\
+
\
+
\
+ State: Logout\
+
\
+
\
+
'
});
})
.controller('vertNavWithRouterController', ['$scope',
@@ -146,6 +178,21 @@
iconClass : "fa fa-space-shuttle",
uiSref: "ipsum"
},
+ {
+ title: "Help",
+ iconClass: "fa pficon-help",
+ uiSref: "help",
+ mobileOnly: true
+ },
+ {
+ title: "User",
+ iconClass: "fa pficon-user",
+ mobileOnly: true,
+ children: [
+ { title: "User Preferences", uiSref: "user-prefs" },
+ { title: "Logout", uiSref: "logout" }
+ ]
+ },
{
title: "Exit Demo"
}
diff --git a/src/navigation/vertical-navigation.html b/src/navigation/vertical-navigation.html
index 2c4f200d5..f050ab17c 100644
--- a/src/navigation/vertical-navigation.html
+++ b/src/navigation/vertical-navigation.html
@@ -35,7 +35,8 @@
'active': item.isActive,
'is-hover': item.isHover,
'mobile-nav-item-pf': item.isMobileItem && $ctrl.showMobileSecondary,
- 'mobile-secondary-item-pf': item.isMobileItem && $ctrl.showMobileTertiary}"
+ 'mobile-secondary-item-pf': item.isMobileItem && $ctrl.showMobileTertiary,
+ 'visible-xs': item.mobileOnly}"
ng-mouseenter="$ctrl.handlePrimaryHover(item)" ng-mouseleave="$ctrl.handlePrimaryUnHover(item)">