walrusk
4/24/2014 - 2:16 PM

PagesInNav.diff

diff --git a/template/Panels/Header.html b/template/Panels/Header.html
index 5508d1c..8cc77d3 100755
--- a/template/Panels/Header.html
+++ b/template/Panels/Header.html
@@ -18,8 +18,9 @@
 			%%GLOBAL_LiveChatCode%%
 		</div>
 		
-		<div class="main-menu nav">
+		<div class="main-menu nav hide-pages-desktop">
 			<a class="toggleMenu" href="#"><span>Menu</span> <i class="icon-reorder"></i></a>
 			%%Panel.SideCategoryList%%
+			%%Panel.PagesMenu%%
 		</div>
 	</header>
\ No newline at end of file
diff --git a/template/Panels/TopMenu.html b/template/Panels/TopMenu.html
index 3f7ed4b..6522352 100755
--- a/template/Panels/TopMenu.html
+++ b/template/Panels/TopMenu.html
@@ -1,10 +1,3 @@
-<div class="top-menu hide-size-desktop">
-	<a href="#" class="hidden"><span>Menu</span> <i class="icon-reorder"></i> %%GLOBAL_SideCartItemCount%%</a>
-	<ul>
-		%%Panel.PagesMenu%%
-	</ul>
-</div>
-
 <div class="account-links">
 	<ul class="inline-list">
 		<li style="display:%%GLOBAL_HideAccountOptions%%" class="account-link top-menu-link"><a href="%%GLOBAL_ShopPath%%/account.php"><i class="icon-user"></i> %%LNG_YourAccount%%</a></li>
diff --git a/template/Styles/styles.css b/template/Styles/styles.css
index cba5cae..b1b0403 100644
--- a/template/Styles/styles.css
+++ b/template/Styles/styles.css
@@ -9208,6 +9208,9 @@ ul.plain {
   color: white;
 }
 
+.nav > li {
+  display: none !important;
+}
 .nav > ul {
   text-align: center;
   list-style: none;
@@ -9320,6 +9323,13 @@ ul.plain {
     border: 0;
   }
 
+  .nav.hide-pages-desktop .last-category-menu-link > a {
+    border: 0;
+  }
+  .nav.hide-pages-desktop .page-menu-link {
+    display: none !important;
+  }
+
   .nav ul ul:after {
     content: "";
     width: 0;
@@ -9422,6 +9432,12 @@ ul.plain {
     margin-top: 15px;
   }
 
+  .nav .page-menu-link:first-child {
+    border: 0;
+    padding-top: 0;
+    margin-top: 0;
+  }
+
   .nav .page-menu-link ~ .page-menu-link {
     border: none;
     margin: 0;
diff --git a/template/js/template.js b/template/js/template.js
index f085184..77dfeb0 100755
--- a/template/js/template.js
+++ b/template/js/template.js
@@ -368,16 +368,26 @@ $(window).bind('resize orientationchange', function() {
 var prepareMenu = function() {
 	$(".nav > ul").removeClass('sf-menu sf-vertical sf-js-enabled');
 
+	// add page menu into ul
+	$('.nav > ul > li:last').addClass('last-category-menu-link');
+	
+	if($('.nav > ul').length == 0) $('.nav').append('<ul></ul>'); // add UL if there is no category menu
+	$('.nav > ul').append( $('.nav .page-menu-link') );
+
+	// adjustments for menus with dropdowns
 	$(".nav li a").each(function() {
-		if ($(this).next().length > 0) {
+		var dropdown = $(this).next('ul:not(:empty)');
+		
+		// remove empty menus
+		var dropdown_menuitems = dropdown.children();
+		if(dropdown_menuitems.length == 0) dropdown.remove();
+		
+		if (dropdown.length > 0 && dropdown_menuitems.length > 0) {
 			$(this).addClass("parent");
+			$(this).after('<a href="'+$(this).attr('href')+'" class="parent-expand-link"></a>');
 		};
 	})
 	
-	$(".nav li a.parent").each(function(){
-		$(this).after('<a href="'+$(this).attr('href')+'" class="parent-expand-link"></a>');
-	});
-	
 	$(".toggleMenu").click(function(e) {
 		e.preventDefault();
 		$(this).toggleClass("active");
@@ -406,7 +416,7 @@ var adjustMenu = function() {
 		});
 		
 		// move top menu
-		$('.nav > ul').append( $('.top-menu > ul > li, .account-links li') );
+		$('.nav > ul').append( $('.account-links li') );
 		$('.top-menu').hide();
 		
 		// adjust menu positioning
@@ -428,7 +438,6 @@ var adjustMenu = function() {
 		
 		// move top menu
 		$('.account-links ul').append( $('.nav .top-menu-link') );
-		$('.top-menu > ul').append( $('.nav .page-menu-link') );
 		$('.top-menu').show();
 		
 		// adjust menu positioning