Update active menu in sidebars

This commit is contained in:
Frederic Guillot
2015-12-24 15:34:50 +01:00
parent 4003b122d0
commit 9ff0abd8d6
8 changed files with 101 additions and 76 deletions

View File

@@ -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
*