From 50d539488f89c6ab6da83ac6fc2b89cacb5e244e Mon Sep 17 00:00:00 2001 From: vladrigos Date: Wed, 5 Aug 2020 15:34:23 +0300 Subject: [PATCH] social links on user card --- .../modules/card/views/user-card/_form.php | 6 +++++ backend/modules/card/views/user-card/view.php | 4 +++ common/models/UserCard.php | 4 ++- ...6_add_columns_links_to_user_card_table.php | 27 +++++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 console/migrations/m200805_113316_add_columns_links_to_user_card_table.php diff --git a/backend/modules/card/views/user-card/_form.php b/backend/modules/card/views/user-card/_form.php index e05d94e..dca2ae2 100755 --- a/backend/modules/card/views/user-card/_form.php +++ b/backend/modules/card/views/user-card/_form.php @@ -70,6 +70,12 @@ use yii\widgets\ActiveForm;
field($model, 'city')->textInput(['maxlength' => true]) ?>
+
+ field($model, 'link_vk')->textInput(['maxlength' => true]) ?> +
+
+ field($model, 'link_telegram')->textInput(['maxlength' => true]) ?> +
diff --git a/backend/modules/card/views/user-card/view.php b/backend/modules/card/views/user-card/view.php index 0b1baef..718d7bc 100755 --- a/backend/modules/card/views/user-card/view.php +++ b/backend/modules/card/views/user-card/view.php @@ -52,6 +52,10 @@ $this->params['breadcrumbs'][] = $this->title; 'email:email', + 'link_vk:url', + + 'link_telegram:url', + 'dob', [ 'attribute' => 'status', diff --git a/common/models/UserCard.php b/common/models/UserCard.php index 1cde826..0b38d71 100755 --- a/common/models/UserCard.php +++ b/common/models/UserCard.php @@ -68,7 +68,7 @@ class UserCard extends \yii\db\ActiveRecord [['fio', 'status', 'gender', 'email'], 'required'], [['gender', 'status', 'position_id', 'id_user'], 'integer'], [['dob', 'created_at', 'updated_at', 'deleted_at'], 'safe'], - [['fio', 'passport', 'photo', 'email', 'resume', 'city'], 'string', 'max' => 255], + [['fio', 'passport', 'photo', 'email', 'resume', 'city', 'link_vk', 'link_telegram'], 'string', 'max' => 255], [['salary'], 'string', 'max' => 100], [['position_id'], 'exist', 'skipOnError' => true, 'targetClass' => Position::class, 'targetAttribute' => ['position_id' => 'id']], [['status'], 'exist', 'skipOnError' => true, 'targetClass' => Status::class, 'targetAttribute' => ['status' => 'id']], @@ -97,6 +97,8 @@ class UserCard extends \yii\db\ActiveRecord 'salary' => 'Зарплата', 'position_id' => 'Должность', 'city' => 'Город', + 'link_vk' => 'VK', + 'link_telegram' => 'Telegram', ]; } diff --git a/console/migrations/m200805_113316_add_columns_links_to_user_card_table.php b/console/migrations/m200805_113316_add_columns_links_to_user_card_table.php new file mode 100644 index 0000000..6a0367f --- /dev/null +++ b/console/migrations/m200805_113316_add_columns_links_to_user_card_table.php @@ -0,0 +1,27 @@ +addColumn('user_card', 'link_vk', $this->string(255)); + $this->addColumn('user_card', 'link_telegram', $this->string(255)); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropColumn('user_card', 'link_vk'); + $this->dropColumn('user_card', 'link_telegram'); + } +}