From 74e59a1bc4ad28143048297cb52ddd96f3e11815 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Fri, 10 Jun 2016 18:41:10 +0200
Subject: [PATCH] Debug prototype feature "testmenuhider"

---
 htdocs/core/lib/functions.lib.php       |  5 +++++
 htdocs/core/menus/standard/eldy.lib.php | 11 ++++++++---
 htdocs/theme/eldy/style.css.php         | 15 +++++++++++++++
 htdocs/theme/md/style.css.php           |  5 +++++
 4 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index e07ca6cc6c4..7ab372153dd 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -5342,6 +5342,11 @@ function printCommonFooter($zone='private')
     	           });'."\n";
     	print '});'."\n";
     	
+    	print '<!-- Set handler to switch left menu page -->'."\n";
+    	print 'jQuery(".menuhider").click(function() {';
+    	print "  $('.side-nav').toggle();  ";
+    	print '});'."\n";
+    	
     	print '</script>'."\n";
 	}
 	
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 6f91bfe4325..d44e1f50775 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -54,7 +54,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
 	if (GETPOST('testmenuhider') && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
 	{
     	$showmode=1;
-    	$classname = 'class="tmenu"';
+    	$classname = 'class="tmenu menuhider"';
     	$idsel='menu';
 	
     	if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
@@ -1425,13 +1425,18 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
 			{
 			    $altok++;
 				$blockvmenuopened=true;
+				$lastopened=true;
+				for($j = ($i + 1); $j < $num; $j++) 
+				{
+				    if (empty($menu_array[$j]['level'])) $lastopened=false;
+				}
 				if ($altok % 2 == 0)
 				{
-					print '<div class="blockvmenuimpair'.$invert.($altok == 1 ? ' blockvmenufirst':'').'">'."\n";
+					print '<div class="blockvmenu blockvmenuimpair'.$invert.($lastopened?' blockvmenulast':'').($altok == 1 ? ' blockvmenufirst':'').'">'."\n";
 				}
 				else
 				{
-					print '<div class="blockvmenupair'.$invert.($altok == 1 ? ' blockvmenufirst':'').'">'."\n";
+					print '<div class="blockvmenu blockvmenupair'.$invert.($lastopened?' blockvmenulast':'').($altok == 1 ? ' blockvmenufirst':'').'">'."\n";
 				}
 			}
 
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index 0d0c97bb474..383fc2f9abe 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -669,6 +669,9 @@ td.showDragHandle {
 
 /* For desktop */
 <?php if (GETPOST('testmenuhider') && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?>
+#id-container {
+	width: 100%;
+}
 .side-nav {
 	border-right: 1px solid #BBB;
 	border-bottom: 1px solid #BBB;
@@ -678,15 +681,27 @@ td.showDragHandle {
 	position: absolute;
     z-index: 200;
 }
+div.blockvmenulogo
+{
+	border-bottom: 0 !important;
+}
+div.blockvmenusearch {
+	border-bottom: 1px solid #e0e0e0;
+	padding-bottom: 10px !important;
+}
 div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks, div.blockvmenuend {
 	border-top: none !important;
 	border-left: none !important;
 	border-right: none !important;
 	border-bottom: 1px solid #e0e0e0;
+	padding-left: 0 !important;
 }
 div.vmenu, td.vmenu {
 	padding-right: 6px !important;
 }
+div.blockvmenulast {
+	border-bottom: 0;
+}
 <?php } ?>
 
 
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 01e844146ff..7f3e5d5040f 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -1444,6 +1444,11 @@ div.blockvmenusearch
     padding-bottom: 10px;
     border-bottom: 1px solid #f4f4f4;
 }
+div.blockvmenusearchphone
+{
+	border-bottom: none;
+	margin-bottom: 0px;
+}
 
 div.blockvmenuhelp
 {
-- 
GitLab