Commit 76405413c2f10e559127ccf0de8a7ec551f4e4b7

Authored by Alexey Boroda
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,6 +135,11 @@
135 ?> 135 ?>
136 136
137 <?php 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 echo $form->field($model, 'blogArticles') 143 echo $form->field($model, 'blogArticles')
139 ->widget( 144 ->widget(
140 Select2::className(), 145 Select2::className(),
@@ -156,7 +161,7 @@ @@ -156,7 +161,7 @@
156 'url' => yii\helpers\Url::to([ '/blog/blog-article/article-list' ]), 161 'url' => yii\helpers\Url::to([ '/blog/blog-article/article-list' ]),
157 'dataType' => 'json', 162 'dataType' => 'json',
158 'data' => new JsExpression( 163 'data' => new JsExpression(
159 - 'function(params) { return {q:params.term, id:' . $model->id . '}; }' 164 + $data
160 ), 165 ),
161 ], 166 ],
162 'templateResult' => new JsExpression('function(article) { return article.text; }'), 167 'templateResult' => new JsExpression('function(article) { return article.text; }'),