Allow logout when JavaScript is disabled
This commit is contained in:
parent
96b8989742
commit
0bfc5f9af5
@ -39,13 +39,18 @@ AppAsset::register($this);
|
||||
['label' => 'Home', 'url' => ['/site/index']],
|
||||
['label' => 'About', 'url' => ['/site/about']],
|
||||
['label' => 'Contact', 'url' => ['/site/contact']],
|
||||
Yii::$app->user->isGuest ?
|
||||
['label' => 'Login', 'url' => ['/site/login']] :
|
||||
[
|
||||
'label' => 'Logout (' . Yii::$app->user->identity->username . ')',
|
||||
'url' => ['/site/logout'],
|
||||
'linkOptions' => ['data-method' => 'post']
|
||||
],
|
||||
Yii::$app->user->isGuest ? (
|
||||
['label' => 'Login', 'url' => ['/site/login']]
|
||||
) : (
|
||||
'<li>'
|
||||
. Html::beginForm(['/site/logout'], 'post')
|
||||
. Html::submitButton(
|
||||
'Logout (' . Yii::$app->user->identity->username . ')',
|
||||
['class' => 'btn btn-link']
|
||||
)
|
||||
. Html::endForm()
|
||||
. '</li>'
|
||||
)
|
||||
],
|
||||
]);
|
||||
NavBar::end();
|
||||
|
Loading…
Reference in New Issue
Block a user