Commit b3ef6f91e58ea60d2da49a99fa26476700926b34

Authored by Yarik
1 parent c1040009

test

common/models/CompanyInfo.php
... ... @@ -11,7 +11,6 @@
11 11 * @property integer $staff
12 12 * @property string $street
13 13 * @property string $house
14   - * @property integer $hide_mail
15 14 */
16 15 class CompanyInfo extends \yii\db\ActiveRecord
17 16 {
... ... @@ -45,10 +44,6 @@
45 44 'string',
46 45 ],
47 46 [
48   - [ 'hide_mail' ],
49   - 'integer',
50   - ],
51   - [
52 47 [ 'staff' ],
53 48 'default',
54 49 'value' => 1,
... ... @@ -72,7 +67,6 @@
72 67 'staff' => Yii::t('app', 'Количество сотрудников'),
73 68 'street' => Yii::t('app', 'Улица'),
74 69 'house' => Yii::t('app', 'Дом'),
75   - 'hide_mail' => Yii::t('app', 'не публиковать Email'),
76 70 ];
77 71 }
78 72 }
... ...
common/models/UserInfo.php
... ... @@ -30,6 +30,7 @@
30 30 * @property string $geography
31 31 * @property integer $salary_currency
32 32 * @property string $email
  33 + * @property integer $hide_mail
33 34 */
34 35 class UserInfo extends \yii\db\ActiveRecord
35 36 {
... ... @@ -215,6 +216,17 @@
215 216 ],
216 217 'email',
217 218 ],
  219 + [
  220 + [ 'hide_mail' ],
  221 + 'integer',
  222 + 'min' => 0,
  223 + 'max' => 1,
  224 + ],
  225 + [
  226 + ['hide_mail'],
  227 + 'default',
  228 + 'value' => 0,
  229 + ]
218 230 ];
219 231 }
220 232  
... ... @@ -268,6 +280,7 @@
268 280 'salary_currency' => Yii::t('app', 'Валюта'),
269 281 'is_customer' => '',
270 282 'is_freelancer' => '',
  283 + 'hide_mail' => Yii::t('app', 'не публиковать Email'),
271 284  
272 285 ];
273 286 }
... ...
console/migrations/m160309_124241_add_vacancy_status.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +class m160309_124241_add_vacancy_status extends Migration
  6 +{
  7 + public function up()
  8 + {
  9 + $this->addColumn('{{%vacancy}}', 'status', $this->integer()->defaultValue(1));
  10 + }
  11 +
  12 + public function down()
  13 + {
  14 + $this->dropColumn('{{%vacancy}}', 'status');
  15 + }
  16 +}
... ...
console/migrations/m160310_080610_hide_email_to_user_info.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +class m160310_080610_hide_email_to_user_info extends Migration
  6 +{
  7 + public function up()
  8 + {
  9 + $this->dropColumn('{{%company_info}}', 'hide_mail');
  10 + $this->addColumn('{{%user_info}}', 'hide_mail', $this->smallInteger()->defaultValue(0));
  11 + }
  12 +
  13 + public function down()
  14 + {
  15 + $this->dropColumn('{{%user_info}}', 'hide_mail');
  16 + $this->addColumn('{{%company_info}}', 'hide_mail', $this->smallInteger()->defaultValue(0));
  17 + }
  18 +}
... ...
frontend/views/accounts/general.php
... ... @@ -176,7 +176,7 @@
176 176 ?>
177 177 </div>
178 178 <div class="input-blocks hide-mail-check">
179   - <?= $form->field ($company_info, 'hide_mail', ['options' => ['class' => 'form-group', ], 'template' => "{input}{label}\n{hint}\n{error}"])
  179 + <?= $form->field ($user_info, 'hide_mail', ['options' => ['class' => 'form-group', ], 'template' => "{input}{label}\n{hint}\n{error}"])
180 180 ->label ('<span></span>не публиковать Email')
181 181 ->checkbox (['checked'=>'checked', 'class'=> 'custom-check'], false);
182 182 ?>
... ...