From 9ff0abd8d683ab5a285fcf70e27d1bcd1cbc47df Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 24 Dec 2015 15:34:50 +0100 Subject: Update active menu in sidebars --- app/Helper/App.php | 24 +++++++++++++++++++++++ app/Template/analytic/sidebar.php | 14 +++++++------- app/Template/app/sidebar.php | 14 +++++++------- app/Template/config/sidebar.php | 22 ++++++++++----------- app/Template/project/sidebar.php | 31 +++++++++++++++--------------- app/Template/project_user/sidebar.php | 8 ++++---- app/Template/task/sidebar.php | 36 +++++++++++++++++------------------ app/Template/user/sidebar.php | 28 +++++++++++++-------------- 8 files changed, 101 insertions(+), 76 deletions(-) diff --git a/app/Helper/App.php b/app/Helper/App.php index 6e6028fc..2015d896 100644 --- a/app/Helper/App.php +++ b/app/Helper/App.php @@ -12,6 +12,30 @@ use Kanboard\Core\Base; */ class App extends Base { + /** + * Make sidebar menu active + * + * @access public + * @param string $controller + * @param string $action + * @param string $plugin + * @return string + */ + public function checkMenuSelection($controller, $action = '', $plugin = '') + { + $result = strtolower($this->getRouterController()) === strtolower($controller); + + if ($result && $action !== '') { + $result = strtolower($this->getRouterAction()) === strtolower($action); + } + + if ($result && $plugin !== '') { + $result = strtolower($this->getPluginName()) === strtolower($plugin); + } + + return $result ? 'class="active"' : ''; + } + /** * Get plugin name from route * diff --git a/app/Template/analytic/sidebar.php b/app/Template/analytic/sidebar.php index 746fcebb..8d4f7023 100644 --- a/app/Template/analytic/sidebar.php +++ b/app/Template/analytic/sidebar.php @@ -1,25 +1,25 @@