Skip to content

Commit

Permalink
Menu active condition fix.
Browse files Browse the repository at this point in the history
Code style correcting.
PHPDoc filling misses.
  • Loading branch information
nikosid committed Oct 20, 2018
1 parent c89d40b commit 824ce27
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
6 changes: 2 additions & 4 deletions backend/views/layouts/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

$bundle = BackendAsset::register($this);

$this->params['body-class'] = array_key_exists('body-class', $this->params) ?
$this->params['body-class']
: null;
$this->params['body-class'] = $this->params['body-class'] ?? null;
?>

<?php $this->beginPage() ?>
Expand Down Expand Up @@ -39,4 +37,4 @@
<?php $this->endBody() ?>
<?php echo Html::endTag('body') ?>
</html>
<?php $this->endPage() ?>
<?php $this->endPage() ?>
3 changes: 2 additions & 1 deletion backend/views/layouts/clear.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
/**
* @var $this yii\web\View
* @var $content string
*/
?>
<?php $this->beginContent('@backend/views/layouts/common.php'); ?>
<?php echo $content ?>
<?php $this->endContent(); ?>
<?php $this->endContent(); ?>
19 changes: 10 additions & 9 deletions backend/views/layouts/common.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* @var $this yii\web\View
* @var $this yii\web\View
* @var $content string
*/

Expand Down Expand Up @@ -154,7 +154,7 @@ class="img-circle"/>
'label' => Yii::t('backend', 'Users'),
'icon' => '<i class="fa fa-users"></i>',
'url' => ['/user/index'],
'active' => (Yii::$app->controller->id == 'user'),
'active' => Yii::$app->controller->id === 'user',
'visible' => Yii::$app->user->can('administrator'),
],
[
Expand All @@ -165,26 +165,27 @@ class="img-circle"/>
'label' => Yii::t('backend', 'Static pages'),
'url' => ['/content/page/index'],
'icon' => '<i class="fa fa-thumb-tack"></i>',
'active' => (Yii::$app->controller->id == 'page'),
'active' => Yii::$app->controller->id === 'page',
],
[
'label' => Yii::t('backend', 'Articles'),
'url' => '#',
'icon' => '<i class="fa fa-files-o"></i>',
'options' => ['class' => 'treeview'],
'active' => (Yii::$app->controller->module->id == 'article'),
'active' => 'content' === Yii::$app->controller->module->id &&
('article' === Yii::$app->controller->id || 'category' === Yii::$app->controller->id),
'items' => [
[
'label' => Yii::t('backend', 'Articles'),
'url' => ['/content/article/index'],
'icon' => '<i class="fa fa-file-o"></i>',
'active' => (Yii::$app->controller->id == 'default'),
'active' => Yii::$app->controller->id === 'article',
],
[
'label' => Yii::t('backend', 'Categories'),
'url' => ['/content/category/index'],
'icon' => '<i class="fa fa-folder-open-o"></i>',
'active' => (Yii::$app->controller->id == 'category'),
'active' => Yii::$app->controller->id === 'category',
],
],
],
Expand All @@ -193,19 +194,19 @@ class="img-circle"/>
'url' => '#',
'icon' => '<i class="fa fa-code"></i>',
'options' => ['class' => 'treeview'],
'active' => (Yii::$app->controller->module->id == 'widget'),
'active' => Yii::$app->controller->module->id === 'widget',
'items' => [
[
'label' => Yii::t('backend', 'Text Blocks'),
'url' => ['/widget/text/index'],
'icon' => '<i class="fa fa-circle-o"></i>',
'active' => (Yii::$app->controller->id == 'text'),
'active' => Yii::$app->controller->id === 'text',
],
[
'label' => Yii::t('backend', 'Menu'),
'url' => ['/widget/menu/index'],
'icon' => '<i class="fa fa-circle-o"></i>',
'active' => (Yii::$app->controller->id == 'menu'),
'active' => Yii::$app->controller->id === 'menu',
],
[
'label' => Yii::t('backend', 'Carousel'),
Expand Down
3 changes: 2 additions & 1 deletion backend/views/layouts/main.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
/**
* @var $this yii\web\View
* @var $content string
*/
?>
<?php $this->beginContent('@backend/views/layouts/common.php'); ?>
Expand All @@ -9,4 +10,4 @@
<?php echo $content ?>
</div>
</div>
<?php $this->endContent(); ?>
<?php $this->endContent(); ?>

0 comments on commit 824ce27

Please sign in to comment.