Added support for data-method and data-confirm.
This commit is contained in:
parent
f7a28f3df0
commit
8a599e9474
@ -3,7 +3,9 @@
|
|||||||
namespace app\controllers;
|
namespace app\controllers;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
|
use yii\web\AccessControl;
|
||||||
use yii\web\Controller;
|
use yii\web\Controller;
|
||||||
|
use yii\web\VerbFilter;
|
||||||
use app\models\LoginForm;
|
use app\models\LoginForm;
|
||||||
use app\models\ContactForm;
|
use app\models\ContactForm;
|
||||||
|
|
||||||
@ -13,7 +15,7 @@ class SiteController extends Controller
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'access' => array(
|
'access' => array(
|
||||||
'class' => \yii\web\AccessControl::className(),
|
'class' => AccessControl::className(),
|
||||||
'only' => array('login', 'logout'),
|
'only' => array('login', 'logout'),
|
||||||
'rules' => array(
|
'rules' => array(
|
||||||
array(
|
array(
|
||||||
@ -28,6 +30,12 @@ class SiteController extends Controller
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
'verbs' => array(
|
||||||
|
'class' => VerbFilter::className(),
|
||||||
|
'actions' => array(
|
||||||
|
'logout' => array('post'),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,9 @@ app\config\AppAsset::register($this);
|
|||||||
array('label' => 'Contact', 'url' => array('/site/contact')),
|
array('label' => 'Contact', 'url' => array('/site/contact')),
|
||||||
Yii::$app->user->isGuest ?
|
Yii::$app->user->isGuest ?
|
||||||
array('label' => 'Login', 'url' => array('/site/login')) :
|
array('label' => 'Login', 'url' => array('/site/login')) :
|
||||||
array('label' => 'Logout (' . Html::encode(Yii::$app->user->identity->username) .')' , 'url' => array('/site/logout')),
|
array('label' => 'Logout (' . Yii::$app->user->identity->username .')' ,
|
||||||
|
'url' => array('/site/logout'),
|
||||||
|
'linkOptions' => array('data-method' => 'post')),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
NavBar::end();
|
NavBar::end();
|
||||||
|
Loading…
Reference in New Issue
Block a user