From 816e328e9fe894cd7a1e99178afd169eb6b6b4b4 Mon Sep 17 00:00:00 2001 From: Yarik Date: Wed, 9 Mar 2016 13:00:23 +0200 Subject: [PATCH] test --- common/models/Team.php | 5 ----- common/models/TeamSearch.php | 6 +++--- common/widgets/ImageUploader.php | 4 +++- common/widgets/views/image_sizer.php | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------- console/migrations/m160208_101449_team.php | 2 +- frontend/controllers/AccountsController.php | 9 +++++++-- frontend/views/accounts/_team_form.php | 27 +++++++++++---------------- frontend/web/css/art_box.css | 4 ++++ frontend/web/css/style.css | 2 +- frontend/web/js/script.js | 1 - 10 files changed, 120 insertions(+), 87 deletions(-) diff --git a/common/models/Team.php b/common/models/Team.php index abaac71..48ac79e 100644 --- a/common/models/Team.php +++ b/common/models/Team.php @@ -34,11 +34,6 @@ return 'team'; } - - - - - /** * @inheritdoc */ diff --git a/common/models/TeamSearch.php b/common/models/TeamSearch.php index b4dff71..b577a08 100644 --- a/common/models/TeamSearch.php +++ b/common/models/TeamSearch.php @@ -170,7 +170,7 @@ 0, ]); } - + $query->andFilterWhere([ 'like', 'firstname', @@ -188,8 +188,8 @@ ]) ->andFilterWhere([ 'like', - 'position', - $this->position, + 'LOWER(position)', + mb_strtolower($this->position), ]) ->andFilterWhere([ 'like', diff --git a/common/widgets/ImageUploader.php b/common/widgets/ImageUploader.php index 8b751ef..c9cad75 100755 --- a/common/widgets/ImageUploader.php +++ b/common/widgets/ImageUploader.php @@ -21,6 +21,7 @@ class ImageUploader extends Widget public $gallery; public $size; public $name = 'Add file...'; + public $remover = false; public function init(){ @@ -40,7 +41,8 @@ class ImageUploader extends Widget 'height' => $this->height, 'width' => $this->width, 'multi' => $this->multi, - 'name' => $this->name + 'name' => $this->name, + 'remover' => $this->remover ]); } diff --git a/common/widgets/views/image_sizer.php b/common/widgets/views/image_sizer.php index 332fda6..66909a3 100755 --- a/common/widgets/views/image_sizer.php +++ b/common/widgets/views/image_sizer.php @@ -21,6 +21,13 @@ $id = $model::tableName().'_id';
+ $field) { + ?> + + $field ? Html::img($model->$field): '' ?>
@@ -34,67 +41,93 @@ $id = $model::tableName().'_id'; diff --git a/console/migrations/m160208_101449_team.php b/console/migrations/m160208_101449_team.php index fbf7e62..f3b81d1 100644 --- a/console/migrations/m160208_101449_team.php +++ b/console/migrations/m160208_101449_team.php @@ -16,7 +16,7 @@ class m160208_101449_team extends Migration 'middlename' => $this->string(255), 'link' => $this->string(255), 'position' => $this->string(255)->notNull(), - 'department_id' => $this->integer()->notNull(), + 'department_id' => $this->integer(), 'experience_from' => $this->integer(), 'date_add' => $this->timestamp()->notNull(), 'user_add_id' => $this->integer(), diff --git a/frontend/controllers/AccountsController.php b/frontend/controllers/AccountsController.php index 4832b15..119bc63 100755 --- a/frontend/controllers/AccountsController.php +++ b/frontend/controllers/AccountsController.php @@ -952,9 +952,14 @@ ->column(); $post = \Yii::$app->request->post(); if($team->load($post) && $team->save()) { - return $this->redirect([ - 'team', + return $this->render('_team_form', [ + 'team' => $team, + 'department' => $department, + 'country' => $country, ]); +// return $this->redirect([ +// 'team', +// ]); } else { return $this->render('_team_form', [ 'team' => $team, diff --git a/frontend/views/accounts/_team_form.php b/frontend/views/accounts/_team_form.php index a1b22ef..69b72f5 100644 --- a/frontend/views/accounts/_team_form.php +++ b/frontend/views/accounts/_team_form.php @@ -8,9 +8,7 @@ use common\models\Team; use common\widgets\ImageUploader; use kartik\select2\Select2; - use mihaildev\ckeditor\CKEditor; use yii\helpers\Html; - use yii\jui\DatePicker; use yii\web\JsExpression; use yii\widgets\ActiveForm; @@ -20,13 +18,9 @@ -
-
- -
-
+
@@ -60,7 +54,7 @@
field($team, 'department_id') - ->dropDownList($department) ?> + ->dropDownList($department, [ 'prompt' => 'Выберите отдел' ]) ?>
@@ -99,13 +93,14 @@
true, 'model' => $team, 'field' => 'photo', - 'size' => [ + 'size' => [ [ - 'width' => 100, - 'height' => 100, - ] + 'width' => 100, + 'height' => 100, + ], ], 'multi' => false, 'gallery' => $team->photo, @@ -115,7 +110,7 @@
- isNewRecord?'Добавить':'Обновить', [ 'class' => 'input-blocks-wrapper button' ]) ?> + isNewRecord ? 'Добавить' : 'Обновить', [ 'class' => 'input-blocks-wrapper button' ]) ?>
isNewRecord) { @@ -133,7 +128,7 @@ ?>
- request->referrer)?\Yii::$app->request->referrer:['accounts/team' ]) ?> + request->referrer) ? \Yii::$app->request->referrer : [ 'accounts/team' ]) ?>
diff --git a/frontend/web/css/art_box.css b/frontend/web/css/art_box.css index a37e966..6db2a72 100755 --- a/frontend/web/css/art_box.css +++ b/frontend/web/css/art_box.css @@ -5,3 +5,7 @@ .form_for_company .company_info { display: none; } +.remover_image { + position: absolute; + cursor: pointer; +} \ No newline at end of file diff --git a/frontend/web/css/style.css b/frontend/web/css/style.css index ad61345..33ba9d4 100755 --- a/frontend/web/css/style.css +++ b/frontend/web/css/style.css @@ -6595,4 +6595,4 @@ input[disabled], select[disabled] { width: 24px; height: 24px; background: transparent url('/images/loading-plugin-new.gif') center left no-repeat; -} \ No newline at end of file +} diff --git a/frontend/web/js/script.js b/frontend/web/js/script.js index e8b369d..5977559 100755 --- a/frontend/web/js/script.js +++ b/frontend/web/js/script.js @@ -559,7 +559,6 @@ $(document).ready(function(){ alert('fdg') } var txtMulti = $('.MultiFile-title').text() - console.log(txtMulti) $('.tender-file-wr a').click(function(e){ e.preventDefault() }) -- libgit2 0.21.4