diff --git a/app/Helper/App.php b/app/Helper/App.php index 6e6028fce..2015d896e 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 746fcebbd..8d4f70238 100644 --- a/app/Template/analytic/sidebar.php +++ b/app/Template/analytic/sidebar.php @@ -1,25 +1,25 @@