Commit 5528fa2f829f7110cff6139303dbd76baf6dae2c
1 parent
cd68a3a3
Убрал behavior с сорта. Теперь можно просто изменять значение поля sort
Showing
3 changed files
with
15 additions
and
9 deletions
Show diff stats
backend/controllers/DoctorController.php
| @@ -156,7 +156,8 @@ | @@ -156,7 +156,8 @@ | ||
| 156 | 'hasAlias' => true, | 156 | 'hasAlias' => true, |
| 157 | 157 | ||
| 158 | 'languageFields' => [ | 158 | 'languageFields' => [ |
| 159 | - [ | 159 | + |
| 160 | + [ | ||
| 160 | 'name' => 'name', | 161 | 'name' => 'name', |
| 161 | 'type' => Form::STRING, | 162 | 'type' => Form::STRING, |
| 162 | 'decorate' => true | 163 | 'decorate' => true |
| @@ -171,6 +172,10 @@ | @@ -171,6 +172,10 @@ | ||
| 171 | ], | 172 | ], |
| 172 | ], | 173 | ], |
| 173 | 'fields' => [ | 174 | 'fields' => [ |
| 175 | + [ | ||
| 176 | + 'name' => 'sort', | ||
| 177 | + 'type' => Form::NUMBER, | ||
| 178 | + ], | ||
| 174 | [ | 179 | [ |
| 175 | 'name' => 'image_id', | 180 | 'name' => 'image_id', |
| 176 | 'type' => Form::IMAGE | 181 | 'type' => Form::IMAGE |
| @@ -186,10 +191,7 @@ | @@ -186,10 +191,7 @@ | ||
| 186 | 'name' => 'status', | 191 | 'name' => 'status', |
| 187 | 'type' => Form::BOOL, | 192 | 'type' => Form::BOOL, |
| 188 | ], | 193 | ], |
| 189 | - [ | ||
| 190 | - 'name' => 'sort', | ||
| 191 | - 'type' => Form::NUMBER, | ||
| 192 | - ], | 194 | + |
| 193 | ], | 195 | ], |
| 194 | ]; | 196 | ]; |
| 195 | } | 197 | } |
common/models/Doctor.php
| @@ -55,10 +55,10 @@ class Doctor extends \yii\db\ActiveRecord | @@ -55,10 +55,10 @@ class Doctor extends \yii\db\ActiveRecord | ||
| 55 | ); | 55 | ); |
| 56 | }, | 56 | }, |
| 57 | ], | 57 | ], |
| 58 | - 'positionBehavior' => [ | ||
| 59 | - 'class' => PositionBehavior::className(), | ||
| 60 | - 'positionAttribute' => 'sort', | ||
| 61 | - ], | 58 | +// 'positionBehavior' => [ |
| 59 | +// 'class' => PositionBehavior::className(), | ||
| 60 | +// 'positionAttribute' => 'sort', | ||
| 61 | +// ], | ||
| 62 | ]; | 62 | ]; |
| 63 | } | 63 | } |
| 64 | /** | 64 | /** |
frontend/controllers/SiteController.php
| @@ -294,6 +294,10 @@ | @@ -294,6 +294,10 @@ | ||
| 294 | { | 294 | { |
| 295 | $doctors = Doctor::find() | 295 | $doctors = Doctor::find() |
| 296 | ->where(['status' => true]) | 296 | ->where(['status' => true]) |
| 297 | + ->orderBy([ | ||
| 298 | + 'sort' => SORT_ASC, | ||
| 299 | + 'id' => SORT_ASC | ||
| 300 | + ]) | ||
| 297 | ->all(); | 301 | ->all(); |
| 298 | 302 | ||
| 299 | return $this->render('doctor', | 303 | return $this->render('doctor', |