From b810b85c928fb6e7b5c3322a6cfbd1bcc43dcb40 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Tue, 5 Aug 2014 07:15:59 +0530 Subject: [PATCH] Show the current status with the icon and change it on hover to show the expected behavior Signed-off-by: Madhura Jayaratne --- js/navigation.js | 30 +++++++++++++++++++ libraries/navigation/NavigationTree.class.php | 4 +-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/js/navigation.js b/js/navigation.js index dfecbad8fa..063b7d2b9b 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -72,6 +72,36 @@ $(function () { }); }); + /** + * Register event handler to toggle + * the 'link with main panel' icon on mouseenter. + */ + $(document).on('mouseenter', '#pma_navigation_sync', function (event) { + event.preventDefault(); + var synced = $('#pma_navigation_tree').hasClass('synced'); + var $img = $('#pma_navigation_sync').children('img'); + if (synced) { + $img.removeClass('ic_s_link').addClass('ic_s_unlink'); + } else { + $img.removeClass('ic_s_unlink').addClass('ic_s_link'); + } + }); + + /** + * Register event handler to toggle + * the 'link with main panel' icon on mouseout. + */ + $(document).on('mouseout', '#pma_navigation_sync', function (event) { + event.preventDefault(); + var synced = $('#pma_navigation_tree').hasClass('synced'); + var $img = $('#pma_navigation_sync').children('img'); + if (synced) { + $img.removeClass('ic_s_unlink').addClass('ic_s_link'); + } else { + $img.removeClass('ic_s_link').addClass('ic_s_unlink'); + } + }); + /** * Register event handler to toggle * the linking with main panel behavior diff --git a/libraries/navigation/NavigationTree.class.php b/libraries/navigation/NavigationTree.class.php index 7bd409cb5c..4ee33fac29 100644 --- a/libraries/navigation/NavigationTree.class.php +++ b/libraries/navigation/NavigationTree.class.php @@ -1132,10 +1132,10 @@ class PMA_NavigationTree 's_collapseall.png', 'pma_navigation_collapse' ); - $syncImage = 's_link.png'; + $syncImage = 's_unlink.png'; $title = __('Link with main panel'); if ($GLOBALS['cfg']['NavigationLinkWithMainPanel']) { - $syncImage = 's_unlink.png'; + $syncImage = 's_link.png'; $title = __('Unlink with main panel'); } $retval .= PMA_Util::getNavigationLink(