Commit 76405413c2f10e559127ccf0de8a7ec551f4e4b7
1 parent
514be31e
-Blog article form fixed
-Table of sizes added -Catalog java script fixed
Showing
1 changed file
with
6 additions
and
1 deletions
Show diff stats
views/blog-article/_form.php
| ... | ... | @@ -135,6 +135,11 @@ |
| 135 | 135 | ?> |
| 136 | 136 | |
| 137 | 137 | <?php |
| 138 | + if (empty( $model->id )) { | |
| 139 | + $data = 'function(params) { return {q:params.term}; }'; | |
| 140 | + } else { | |
| 141 | + $data = 'function(params) { return {q:params.term, id:' . $model->id . '}; }'; | |
| 142 | + } | |
| 138 | 143 | echo $form->field($model, 'blogArticles') |
| 139 | 144 | ->widget( |
| 140 | 145 | Select2::className(), |
| ... | ... | @@ -156,7 +161,7 @@ |
| 156 | 161 | 'url' => yii\helpers\Url::to([ '/blog/blog-article/article-list' ]), |
| 157 | 162 | 'dataType' => 'json', |
| 158 | 163 | 'data' => new JsExpression( |
| 159 | - 'function(params) { return {q:params.term, id:' . $model->id . '}; }' | |
| 164 | + $data | |
| 160 | 165 | ), |
| 161 | 166 | ], |
| 162 | 167 | 'templateResult' => new JsExpression('function(article) { return article.text; }'), | ... | ... |