jacmoe/yii2-gii-jade

Jade Gii Generator for Yii2

Installs: 89

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

0.2.0 2015-11-10 16:35 UTC

This package is not auto-updated.

Last update: 2024-04-23 01:55:47 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

Works well with Yii2 Tale Jade, the Tale Jade for PHP integration for the Yii2 framework.

Installation with Composer

Installation is recommended to be done via composer by running:

composer require jacmoe/yii2-gii-jade "*"

Configuration

Add it to your configuration (frontend/config/main-local.php and/or backend/config/main-local.php for the advanced template).

Add the generator

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',
        ]
      ]
    ],
  ];
}

Set defaultExtension

'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,])

Known Bugs

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

License

The Jade Gii Generator for Yii2 is released under the MIT license.