Works well with Yii2 Tale Jade, the Tale Jade for PHP integration for the Yii2 framework.
Installation is recommended to be done via composer by running:
composer require jacmoe/yii2-gii-jade "*"
Add it to your configuration (frontend/config/main-local.php and/or backend/config/main-local.php for the advanced template).
if (!YII_ENV_TEST) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.178.20'],
'generators' => [
'jadecrud' => [
'class' => 'jacmoe\giijade\crud\Generator',
'templates' => [
'myCrud' => '@jacmoe/giijade/crud/default',
]
]
],
];
}
'components' => [
...
],
'view' => [
'defaultExtension' => 'jade',
...
Alternatively, if you don't want to set the default extension for the views, then you need to explicitly set the extension in your views/controllers.
For instance:
public function actionAbout()
{
return $this->render('about.jade');
}
...
$this->render('_form.jade', ['model' => $model,])
When the i18n option is turned on for the generator, there will be an error in update.jade that looks like this:
-$view->title = Yii::t('app', 'Update {modelClass}: ', [
'modelClass' => 'User',
]) . ' ' . $model->id
You need to remove the line breaks, like this:
-$view->title = Yii::t('app', 'Update {modelClass}: ', ['modelClass' => 'User',]) . ' ' . $model->id
The Jade Gii Generator for Yii2 is released under the MIT license.
Comments