@@ -5,7 +5,7 @@ |
||
| 5 | 5 | use schmunk42\giiant\generators\crud\callbacks\yii\Db; |
| 6 | 6 | use schmunk42\giiant\generators\crud\callbacks\yii\Html; |
| 7 | 7 | |
| 8 | -$aceEditorField = function ($attribute, $model, $generator) { |
|
| 8 | +$aceEditorField = function($attribute, $model, $generator) { |
|
| 9 | 9 | return "\$form->field(\$model, '{$attribute}')->widget(\\trntv\\aceeditor\\AceEditor::className())"; |
| 10 | 10 | }; |
| 11 | 11 | |
@@ -18,8 +18,7 @@ discard block |
||
| 18 | 18 | // Note: For using mounted volumes or shared folders |
| 19 | 19 | 'dirMode' => YII_ENV_PROD ? 0777 : null, |
| 20 | 20 | 'bundles' => getenv('APP_ASSET_USE_BUNDLED') ? |
| 21 | - require(__DIR__.'/assets-gen/prod.php') : |
|
| 22 | - [ |
|
| 21 | + require(__DIR__.'/assets-gen/prod.php') : [ |
|
| 23 | 22 | // Note: if your asset bundle includes bootstrap, you can disable the default asset |
| 24 | 23 | #'yii\bootstrap\BootstrapAsset' => false, |
| 25 | 24 | ], |
@@ -78,7 +77,7 @@ discard block |
||
| 78 | 77 | 'docs/<file:[a-zA-Z0-9_\-\./]+>' => 'docs', |
| 79 | 78 | #'docs' => 'docs/default/index', |
| 80 | 79 | ], |
| 81 | - 'languages' => explode(',',getenv('APP_LANGUAGES')), |
|
| 80 | + 'languages' => explode(',', getenv('APP_LANGUAGES')), |
|
| 82 | 81 | ], |
| 83 | 82 | 'user' => [ |
| 84 | 83 | 'class' => 'app\components\User', |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | ], |
| 29 | 29 | [ |
| 30 | 30 | 'allow' => true, |
| 31 | - 'matchCallback' => function ($rule, $action) { |
|
| 31 | + 'matchCallback' => function($rule, $action) { |
|
| 32 | 32 | return \Yii::$app->user->can( |
| 33 | 33 | $this->module->id.'_'.$this->id.'_'.$action->id, |
| 34 | 34 | ['route' => true] |
@@ -60,8 +60,7 @@ |
||
| 60 | 60 | |
| 61 | 61 | // check for module configuration and assign to favourites |
| 62 | 62 | $moduleConfigItem = (is_object($module)) ? |
| 63 | - (isset($module->params['menuItems']) ? $module->params['menuItems'] : []) : |
|
| 64 | - (isset($module['params']['menuItems']) ? $module['params']['menuItems'] : []); |
|
| 63 | + (isset($module->params['menuItems']) ? $module->params['menuItems'] : []) : (isset($module['params']['menuItems']) ? $module['params']['menuItems'] : []); |
|
| 65 | 64 | switch (true) { |
| 66 | 65 | case !empty($moduleConfigItem): |
| 67 | 66 | $moduleConfigItem = array_merge($defaultItem, $moduleConfigItem); |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | 'rules' => [ |
| 26 | 26 | [ |
| 27 | 27 | 'allow' => true, |
| 28 | - 'matchCallback' => function ($rule, $action) {return \Yii::$app->user->can($this->module->id . '_' . $this->id . '_' . $action->id, ['route' => true]);}, |
|
| 28 | + 'matchCallback' => function($rule, $action) {return \Yii::$app->user->can($this->module->id.'_'.$this->id.'_'.$action->id, ['route' => true]); }, |
|
| 29 | 29 | ] |
| 30 | 30 | ] |
| 31 | 31 | ] |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | 'rules' => [ |
| 35 | 35 | [ |
| 36 | 36 | 'allow' => true, |
| 37 | - 'matchCallback' => function ($rule, $action) {return \Yii::$app->user->can($this->module->id . '_' . $this->id . '_' . $action->id, ['route' => true]);}, |
|
| 37 | + 'matchCallback' => function($rule, $action) {return \Yii::$app->user->can($this->module->id.'_'.$this->id.'_'.$action->id, ['route' => true]); }, |
|
| 38 | 38 | ] |
| 39 | 39 | ] |
| 40 | 40 | ] |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $model->load($_GET); |
| 95 | 95 | } |
| 96 | 96 | } catch (\Exception $e) { |
| 97 | - $msg = (isset($e->errorInfo[2]))?$e->errorInfo[2]:$e->getMessage(); |
|
| 97 | + $msg = (isset($e->errorInfo[2])) ? $e->errorInfo[2] : $e->getMessage(); |
|
| 98 | 98 | $model->addError('_exception', $msg); |
| 99 | 99 | } |
| 100 | 100 | return $this->render('create', ['model' => $model]); |
@@ -130,13 +130,13 @@ discard block |
||
| 130 | 130 | try { |
| 131 | 131 | $this->findModel($id)->delete(); |
| 132 | 132 | } catch (\Exception $e) { |
| 133 | - $msg = (isset($e->errorInfo[2]))?$e->errorInfo[2]:$e->getMessage(); |
|
| 133 | + $msg = (isset($e->errorInfo[2])) ? $e->errorInfo[2] : $e->getMessage(); |
|
| 134 | 134 | \Yii::$app->getSession()->addFlash('error', $msg); |
| 135 | 135 | return $this->redirect(Url::previous()); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | // TODO: improve detection |
| 139 | - $isPivot = strstr('$id',','); |
|
| 139 | + $isPivot = strstr('$id', ','); |
|
| 140 | 140 | if ($isPivot == true) { |
| 141 | 141 | return $this->redirect(Url::previous()); |
| 142 | 142 | } elseif (isset(\Yii::$app->session['__crudReturnUrl']) && \Yii::$app->session['__crudReturnUrl'] != '/') { |
@@ -9,17 +9,17 @@ |
||
| 9 | 9 | { |
| 10 | 10 | $this->createTable('{{%html}}', [ |
| 11 | 11 | 'id' => Schema::TYPE_PK, |
| 12 | - 'key' => Schema::TYPE_STRING . ' NOT NULL', |
|
| 13 | - 'value' => Schema::TYPE_TEXT . ' NOT NULL', |
|
| 12 | + 'key' => Schema::TYPE_STRING.' NOT NULL', |
|
| 13 | + 'value' => Schema::TYPE_TEXT.' NOT NULL', |
|
| 14 | 14 | ]); |
| 15 | - $this->createIndex('html_key_unique','{{%html}}', 'key', true); |
|
| 15 | + $this->createIndex('html_key_unique', '{{%html}}', 'key', true); |
|
| 16 | 16 | |
| 17 | 17 | $this->createTable('{{%less}}', [ |
| 18 | 18 | 'id' => Schema::TYPE_PK, |
| 19 | - 'key' => Schema::TYPE_STRING . ' NOT NULL', |
|
| 19 | + 'key' => Schema::TYPE_STRING.' NOT NULL', |
|
| 20 | 20 | 'value' => Schema::TYPE_TEXT, |
| 21 | 21 | ]); |
| 22 | - $this->createIndex('less_key_unique','{{%less}}', 'key', true); |
|
| 22 | + $this->createIndex('less_key_unique', '{{%less}}', 'key', true); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function down() |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * @var app\modules\prototype\models\Html $model |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -$this->title = 'Html ' . $model->id . ', ' . Yii::t('app', 'Edit'); |
|
| 10 | +$this->title = 'Html '.$model->id.', '.Yii::t('app', 'Edit'); |
|
| 11 | 11 | $this->params['breadcrumbs'][] = ['label' => 'Htmls', 'url' => ['index']]; |
| 12 | 12 | $this->params['breadcrumbs'][] = ['label' => (string)$model->id, 'url' => ['view', 'id' => $model->id]]; |
| 13 | 13 | $this->params['breadcrumbs'][] = Yii::t('app', 'Edit'); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | </h1> |
| 21 | 21 | |
| 22 | 22 | <div class="crud-navigation"> |
| 23 | - <?= Html::a('<span class="glyphicon glyphicon-eye-open"></span> ' . Yii::t('app', 'View'), ['view', 'id' => $model->id], ['class' => 'btn btn-default']) ?> |
|
| 23 | + <?= Html::a('<span class="glyphicon glyphicon-eye-open"></span> '.Yii::t('app', 'View'), ['view', 'id' => $model->id], ['class' => 'btn btn-default']) ?> |
|
| 24 | 24 | </div> |
| 25 | 25 | |
| 26 | 26 | <?php echo $this->render('_form', [ |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | $copyParams = $model->attributes; |
| 15 | 15 | |
| 16 | -$this->title = 'Html ' . $model->id; |
|
| 16 | +$this->title = 'Html '.$model->id; |
|
| 17 | 17 | $this->params['breadcrumbs'][] = ['label' => 'Htmls', 'url' => ['index']]; |
| 18 | 18 | $this->params['breadcrumbs'][] = ['label' => (string)$model->id, 'url' => ['view', 'id' => $model->id]]; |
| 19 | 19 | $this->params['breadcrumbs'][] = Yii::t('app', 'View'); |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | <div class="clearfix crud-navigation"> |
| 40 | 40 | <!-- menu buttons --> |
| 41 | 41 | <div class='pull-left'> |
| 42 | - <?= Html::a('<span class="glyphicon glyphicon-pencil"></span> ' . Yii::t('app', 'Edit'), ['update', 'id' => $model->id],['class' => 'btn btn-info']) ?> |
|
| 43 | - <?= Html::a('<span class="glyphicon glyphicon-copy"></span> ' . Yii::t('app', 'Copy'), ['create', 'id' => $model->id, 'Html'=>$copyParams],['class' => 'btn btn-success']) ?> |
|
| 44 | - <?= Html::a('<span class="glyphicon glyphicon-plus"></span> ' . Yii::t('app', 'New'), ['create'], ['class' => 'btn btn-success']) ?> |
|
| 42 | + <?= Html::a('<span class="glyphicon glyphicon-pencil"></span> '.Yii::t('app', 'Edit'), ['update', 'id' => $model->id], ['class' => 'btn btn-info']) ?> |
|
| 43 | + <?= Html::a('<span class="glyphicon glyphicon-copy"></span> '.Yii::t('app', 'Copy'), ['create', 'id' => $model->id, 'Html'=>$copyParams], ['class' => 'btn btn-success']) ?> |
|
| 44 | + <?= Html::a('<span class="glyphicon glyphicon-plus"></span> '.Yii::t('app', 'New'), ['create'], ['class' => 'btn btn-success']) ?> |
|
| 45 | 45 | </div> |
| 46 | 46 | <div class="pull-right"> |
| 47 | - <?= Html::a('<span class="glyphicon glyphicon-list"></span> ' . Yii::t('app', 'List Htmls'), ['index'], ['class'=>'btn btn-default']) ?> |
|
| 47 | + <?= Html::a('<span class="glyphicon glyphicon-list"></span> '.Yii::t('app', 'List Htmls'), ['index'], ['class'=>'btn btn-default']) ?> |
|
| 48 | 48 | </div> |
| 49 | 49 | |
| 50 | 50 | </div> |
@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | <hr/> |
| 67 | 67 | |
| 68 | - <?= Html::a('<span class="glyphicon glyphicon-trash"></span> ' . Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], |
|
| 68 | + <?= Html::a('<span class="glyphicon glyphicon-trash"></span> '.Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], |
|
| 69 | 69 | [ |
| 70 | 70 | 'class' => 'btn btn-danger', |
| 71 | - 'data-confirm' => '' . Yii::t('app', 'Are you sure to delete this item?') . '', |
|
| 71 | + 'data-confirm' => ''.Yii::t('app', 'Are you sure to delete this item?').'', |
|
| 72 | 72 | 'data-method' => 'post', |
| 73 | 73 | ]); ?> |
| 74 | 74 | <?php $this->endBlock(); ?> |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | [ |
| 80 | 80 | 'id' => 'relation-tabs', |
| 81 | 81 | 'encodeLabels' => false, |
| 82 | - 'items' => [ [ |
|
| 82 | + 'items' => [[ |
|
| 83 | 83 | 'label' => '<b class=""># '.$model->id.'</b>', |
| 84 | 84 | 'content' => $this->blocks['app\modules\prototype\models\Html'], |
| 85 | 85 | 'active' => true, |