Allow logout when JavaScript is disabled

This commit is contained in:
Alexander Makarov 2015-10-21 01:05:51 +03:00
parent 96b8989742
commit 0bfc5f9af5

View File

@ -39,13 +39,18 @@ AppAsset::register($this);
['label' => 'Home', 'url' => ['/site/index']], ['label' => 'Home', 'url' => ['/site/index']],
['label' => 'About', 'url' => ['/site/about']], ['label' => 'About', 'url' => ['/site/about']],
['label' => 'Contact', 'url' => ['/site/contact']], ['label' => 'Contact', 'url' => ['/site/contact']],
Yii::$app->user->isGuest ? Yii::$app->user->isGuest ? (
['label' => 'Login', 'url' => ['/site/login']] : ['label' => 'Login', 'url' => ['/site/login']]
[ ) : (
'label' => 'Logout (' . Yii::$app->user->identity->username . ')', '<li>'
'url' => ['/site/logout'], . Html::beginForm(['/site/logout'], 'post')
'linkOptions' => ['data-method' => 'post'] . Html::submitButton(
], 'Logout (' . Yii::$app->user->identity->username . ')',
['class' => 'btn btn-link']
)
. Html::endForm()
. '</li>'
)
], ],
]); ]);
NavBar::end(); NavBar::end();