Commit 4a3f5562898e4f0f1e87bef030845c303626d317
1 parent
4476eb35
test
Showing
11 changed files
with
100 additions
and
64 deletions
Show diff stats
common/models/Gallery.php
common/models/PortfolioUser.php
@@ -136,6 +136,7 @@ | @@ -136,6 +136,7 @@ | ||
136 | $gallery = new Gallery([ | 136 | $gallery = new Gallery([ |
137 | 'user_id' => $this->user_id, | 137 | 'user_id' => $this->user_id, |
138 | 'name' => $this->portfolio->name, | 138 | 'name' => $this->portfolio->name, |
139 | + 'cover' => '/images/imageNotFound.jpg', | ||
139 | ]); | 140 | ]); |
140 | if($gallery->save()) { | 141 | if($gallery->save()) { |
141 | $portfolioGallery = new PortfolioGallery([ | 142 | $portfolioGallery = new PortfolioGallery([ |
common/modules/file/widgets/views/image_sizer.php
@@ -4,7 +4,6 @@ | @@ -4,7 +4,6 @@ | ||
4 | $field_name = mb_strtolower($model->formName()) . "-" . $field; | 4 | $field_name = mb_strtolower($model->formName()) . "-" . $field; |
5 | 5 | ||
6 | $id = $model->tableSchema->primaryKey[ 0 ]; | 6 | $id = $model->tableSchema->primaryKey[ 0 ]; |
7 | - | ||
8 | ?> | 7 | ?> |
9 | <div class="file-uploader-block"> | 8 | <div class="file-uploader-block"> |
10 | <?php if(!$multi): ?> | 9 | <?php if(!$multi): ?> |
@@ -40,7 +39,6 @@ | @@ -40,7 +39,6 @@ | ||
40 | $( | 39 | $( |
41 | function() | 40 | function() |
42 | { | 41 | { |
43 | - | ||
44 | $("#<?= $field?>").fileupload( | 42 | $("#<?= $field?>").fileupload( |
45 | { | 43 | { |
46 | dataType : 'json', formData : {size : '<?= json_encode($size)?>'}, | 44 | dataType : 'json', formData : {size : '<?= json_encode($size)?>'}, |
@@ -66,7 +64,7 @@ | @@ -66,7 +64,7 @@ | ||
66 | block.append(img); | 64 | block.append(img); |
67 | block.parents('.file-uploader-block').parent() | 65 | block.parents('.file-uploader-block').parent() |
68 | .addClass('success_download'); | 66 | .addClass('success_download'); |
69 | - $("#<?=$field_name?>").val(data.result.link); | 67 | + $("#<?=$field_name?>").val(data.result.link).trigger('change'); |
70 | $("#<?=$field?>_new_img").val(data.result.link); | 68 | $("#<?=$field?>_new_img").val(data.result.link); |
71 | } | 69 | } |
72 | } | 70 | } |
@@ -90,7 +88,7 @@ | @@ -90,7 +88,7 @@ | ||
90 | { | 88 | { |
91 | } | 89 | } |
92 | ); | 90 | ); |
93 | - $("#<?=$field_name?>").val(new_url); | 91 | + $("#<?=$field_name?>").val(new_url).trigger('change'); |
94 | } | 92 | } |
95 | ); | 93 | ); |
96 | 94 | ||
@@ -101,7 +99,9 @@ | @@ -101,7 +99,9 @@ | ||
101 | .removeClass('success_download'); | 99 | .removeClass('success_download'); |
102 | $("#<?= $field?>_img_block").parent().parent().find('.admin-ava-wr') | 100 | $("#<?= $field?>_img_block").parent().parent().find('.admin-ava-wr') |
103 | .remove(); | 101 | .remove(); |
104 | - | 102 | + if($(this).hasClass('remover_image')) { |
103 | + $('#<?=$field?>_new_img').val(''); | ||
104 | + } | ||
105 | $("#<?=$field?>_buttons_block").remove(); | 105 | $("#<?=$field?>_buttons_block").remove(); |
106 | var old_url = $('#<?=$field?>_old_img').val(); | 106 | var old_url = $('#<?=$field?>_old_img').val(); |
107 | var new_url = $('#<?=$field?>_new_img').val(); | 107 | var new_url = $('#<?=$field?>_new_img').val(); |
@@ -112,10 +112,16 @@ | @@ -112,10 +112,16 @@ | ||
112 | ); | 112 | ); |
113 | <?php | 113 | <?php |
114 | if($remover) { | 114 | if($remover) { |
115 | - echo "$(\"#$field_name\").val(''); | ||
116 | - $('#{$field}_img_block').find('img').remove();"; | 115 | + echo "if(old_url.length<1 || new_url.length<1) { |
116 | + $(\"#$field_name\").val(''); | ||
117 | + $('#{$field}_img_block').find('img').remove(); | ||
118 | + } else { | ||
119 | + $(\"#$field_name\").val(old_url).trigger('change'); | ||
120 | + $('#{$field}_remove_img').append('<img src=\'/images/delete-ico.png\'>'); | ||
121 | + $('#{$field}_img_block').find('.admin-avatar-pattern').append('<img src=\"'+old_url+'\">'); | ||
122 | + }"; | ||
117 | } else { | 123 | } else { |
118 | - echo "$(\"#$field_name\").val(old_url); | 124 | + echo "$(\"#$field_name\").val(old_url).trigger('change'); |
119 | if(old_url.length<=1){ | 125 | if(old_url.length<=1){ |
120 | $('#{$field}_img_block').find('img').remove() | 126 | $('#{$field}_img_block').find('img').remove() |
121 | } | 127 | } |
frontend/controllers/AjaxController.php
@@ -27,6 +27,9 @@ | @@ -27,6 +27,9 @@ | ||
27 | public function actionProjectUser() | 27 | public function actionProjectUser() |
28 | { | 28 | { |
29 | $ids = json_decode(\Yii::$app->request->get('ids')); | 29 | $ids = json_decode(\Yii::$app->request->get('ids')); |
30 | + if(!empty(\Yii::$app->user->id)) { | ||
31 | + array_push($ids, \Yii::$app->user->id); | ||
32 | + } | ||
30 | $model = new UserSearch(); | 33 | $model = new UserSearch(); |
31 | $dataProvider = $model->search(\Yii::$app->request->queryParams); | 34 | $dataProvider = $model->search(\Yii::$app->request->queryParams); |
32 | $dataProvider->query->andFilterWhere([ | 35 | $dataProvider->query->andFilterWhere([ |
frontend/controllers/PerformerController.php
@@ -335,7 +335,7 @@ | @@ -335,7 +335,7 @@ | ||
335 | } | 335 | } |
336 | 336 | ||
337 | $gallery = new ActiveDataProvider([ | 337 | $gallery = new ActiveDataProvider([ |
338 | - 'query' => $user->getGalleries(), | 338 | + 'query' => $user->getGalleries()->andWhere(['not', ['photo' => '']])->andWhere(['not', ['photo' => NULL]]), |
339 | 'pagination' => [ | 339 | 'pagination' => [ |
340 | 'pageSize' => 5, | 340 | 'pageSize' => 5, |
341 | ], | 341 | ], |
frontend/views/accounts/_gallery_form.php
1 | <?php | 1 | <?php |
2 | /** | 2 | /** |
3 | * @var Gallery $gallery | 3 | * @var Gallery $gallery |
4 | - * @var User $user | 4 | + * @var User $user |
5 | */ | 5 | */ |
6 | use common\components\Request; | 6 | use common\components\Request; |
7 | use common\models\Gallery; | 7 | use common\models\Gallery; |
@@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
24 | <div class="input-blocks-wrapper"> | 24 | <div class="input-blocks-wrapper"> |
25 | <div class="input-blocks"> | 25 | <div class="input-blocks"> |
26 | <?= $form->field($gallery, 'name') | 26 | <?= $form->field($gallery, 'name') |
27 | - ->textInput (['class'=> 'custom-input-2']) ?> | 27 | + ->textInput([ 'class' => 'custom-input-2' ]) ?> |
28 | </div> | 28 | </div> |
29 | </div> | 29 | </div> |
30 | 30 | ||
@@ -32,27 +32,47 @@ | @@ -32,27 +32,47 @@ | ||
32 | <?= ImageUploader::widget([ | 32 | <?= ImageUploader::widget([ |
33 | 'model' => $gallery, | 33 | 'model' => $gallery, |
34 | 'field' => 'cover', | 34 | 'field' => 'cover', |
35 | - 'size' => [ | 35 | + 'size' => [ |
36 | [ | 36 | [ |
37 | - 'width' => 210, | ||
38 | - 'height' => 150, | ||
39 | - ] | 37 | + 'width' => 210, |
38 | + 'height' => 150, | ||
39 | + ], | ||
40 | ], | 40 | ], |
41 | - | 41 | + 'remover' => true, |
42 | 'multi' => false, | 42 | 'multi' => false, |
43 | 'gallery' => $gallery->cover, | 43 | 'gallery' => $gallery->cover, |
44 | 'name' => 'Загрузить главное фото', | 44 | 'name' => 'Загрузить главное фото', |
45 | ]); ?> | 45 | ]); ?> |
46 | + <div class="help-block"></div> | ||
47 | + <?php | ||
48 | + $client = ''; | ||
49 | + foreach($gallery->getActiveValidators('cover') as $validator) { | ||
50 | + $client .= $validator->clientValidateAttribute($gallery, 'cover', $this); | ||
51 | + } | ||
52 | + $js = " | ||
53 | + $('#".$form->id."').yiiActiveForm( | ||
54 | + 'add', { | ||
55 | + container : '.admin-avatar', | ||
56 | + error : '.help-block', | ||
57 | + id : 'gallery-cover', | ||
58 | + input : '#gallery-cover', | ||
59 | + name : 'Gallery[cover]', | ||
60 | + validate: function(attribute, value, messages, deferred) { ".$client." } | ||
61 | + } | ||
62 | + ); | ||
63 | + "; | ||
64 | + $this->registerJs($js, $this::POS_LOAD); | ||
65 | + ?> | ||
46 | </div> | 66 | </div> |
47 | <div class="admin-gallery-photos-load-wr style"> | 67 | <div class="admin-gallery-photos-load-wr style"> |
48 | <?= ImageUploader::widget([ | 68 | <?= ImageUploader::widget([ |
49 | 'model' => $gallery, | 69 | 'model' => $gallery, |
50 | 'field' => 'photo', | 70 | 'field' => 'photo', |
51 | - 'size' => [ | 71 | + 'size' => [ |
52 | [ | 72 | [ |
53 | - 'width' => 152, | ||
54 | - 'height' => 108, | ||
55 | - ] | 73 | + 'width' => 152, |
74 | + 'height' => 108, | ||
75 | + ], | ||
56 | ], | 76 | ], |
57 | 'multi' => true, | 77 | 'multi' => true, |
58 | 'gallery' => $gallery->photo, | 78 | 'gallery' => $gallery->photo, |
@@ -61,29 +81,28 @@ | @@ -61,29 +81,28 @@ | ||
61 | </div> | 81 | </div> |
62 | 82 | ||
63 | 83 | ||
64 | - | ||
65 | <div class="input-blocks-wrapper"> | 84 | <div class="input-blocks-wrapper"> |
66 | <div class="admin-save-btn skills-save-btn admin-add-remove-wr style"> | 85 | <div class="admin-save-btn skills-save-btn admin-add-remove-wr style"> |
67 | - <?= Html::submitButton($gallery->isNewRecord? Yii::t('app', 'add'):'Обновить', [ 'class' => 'input-blocks-wrapper button' ]) ?> | 86 | + <?= Html::submitButton($gallery->isNewRecord ? Yii::t('app', 'add') : 'Обновить', [ 'class' => 'input-blocks-wrapper button' ]) ?> |
68 | <div class="admin-remove-note"> | 87 | <div class="admin-remove-note"> |
69 | <?php | 88 | <?php |
70 | - if(!$gallery->isNewRecord) { | ||
71 | - echo Html::a(Yii::t('app', 'delete'), [ | ||
72 | - 'accounts/gallery-delete', | ||
73 | - 'id' => $gallery->gallery_id, | ||
74 | - ], [ | ||
75 | - 'title' => Yii::t('app', 'delete'), | ||
76 | - 'aria-label' => Yii::t('app', 'delete'), | ||
77 | - 'data-confirm' => Yii::t('app', 'delete_confirm'), | ||
78 | - 'data-method' => 'post', | ||
79 | - 'data-pjax' => 0, | ||
80 | - ]); | ||
81 | - } | 89 | + if(!$gallery->isNewRecord) { |
90 | + echo Html::a(Yii::t('app', 'delete'), [ | ||
91 | + 'accounts/gallery-delete', | ||
92 | + 'id' => $gallery->gallery_id, | ||
93 | + ], [ | ||
94 | + 'title' => Yii::t('app', 'delete'), | ||
95 | + 'aria-label' => Yii::t('app', 'delete'), | ||
96 | + 'data-confirm' => Yii::t('app', 'delete_confirm'), | ||
97 | + 'data-method' => 'post', | ||
98 | + 'data-pjax' => 0, | ||
99 | + ]); | ||
100 | + } | ||
82 | ?> | 101 | ?> |
83 | </div> | 102 | </div> |
84 | 103 | ||
85 | <div class="admin-back-note"> | 104 | <div class="admin-back-note"> |
86 | - <?= Html::a('вернуться', Request::getIsLocal(\Yii::$app->request->referrer)?\Yii::$app->request->referrer:['accounts/gallery' ]) ?> | 105 | + <?= Html::a('вернуться', Request::getIsLocal(\Yii::$app->request->referrer) ? \Yii::$app->request->referrer : [ 'accounts/gallery' ]) ?> |
87 | </div> | 106 | </div> |
88 | </div> | 107 | </div> |
89 | </div> | 108 | </div> |
frontend/views/company/gallery.php
@@ -52,7 +52,9 @@ | @@ -52,7 +52,9 @@ | ||
52 | { | 52 | { |
53 | $('#demo5').scrollbox( | 53 | $('#demo5').scrollbox( |
54 | { | 54 | { |
55 | - direction : 'h', distance : 220, autoPlay : false | 55 | + direction : 'h', |
56 | + distance : 220, | ||
57 | + autoPlay : false | ||
56 | } | 58 | } |
57 | ); | 59 | ); |
58 | $('#demo5-backward').click( | 60 | $('#demo5-backward').click( |
frontend/views/layouts/gallery.php
@@ -74,6 +74,7 @@ | @@ -74,6 +74,7 @@ | ||
74 | 'performer_id' => $this->params[ 'user' ]->id, | 74 | 'performer_id' => $this->params[ 'user' ]->id, |
75 | 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL, | 75 | 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL, |
76 | ], | 76 | ], |
77 | + 'visible' => ( empty( $this->params[ 'type' ] ) || $this->params[ 'type' ] == 'implementer' ) ? true : false, | ||
77 | ], | 78 | ], |
78 | [ | 79 | [ |
79 | 'label' => 'Заказанные работы', | 80 | 'label' => 'Заказанные работы', |
@@ -82,6 +83,7 @@ | @@ -82,6 +83,7 @@ | ||
82 | 'performer_id' => $this->params[ 'user' ]->id, | 83 | 'performer_id' => $this->params[ 'user' ]->id, |
83 | 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL, | 84 | 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL, |
84 | ], | 85 | ], |
86 | + 'visible' => ( !empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer' ) ? true : false, | ||
85 | ], | 87 | ], |
86 | [ | 88 | [ |
87 | 'label' => 'Блог', | 89 | 'label' => 'Блог', |
frontend/views/performer/gallery.php
@@ -9,31 +9,35 @@ | @@ -9,31 +9,35 @@ | ||
9 | $this->params[ 'user' ] = $user; | 9 | $this->params[ 'user' ] = $user; |
10 | $this->title = 'My Yii Application'; | 10 | $this->title = 'My Yii Application'; |
11 | ?> | 11 | ?> |
12 | -<div class="video-performer-wrapper style"> | ||
13 | - <div class="gallery-title">Видео: <?= count($videos) ?></div> | ||
14 | - <div class="slider-video-wr"> | ||
15 | - <div id="demo5" class="scroll-img video-slider"> | ||
16 | - <ul> | ||
17 | - <?php foreach($videos as $video): ?> | ||
18 | - <li> | ||
19 | - <div class="iframe-video"> | ||
20 | - <iframe width="560" height="320" src="<?= $video[ 'youtube' ] ?>" frameborder="0" allowfullscreen></iframe> | ||
21 | - </div> | 12 | +<?php |
13 | + if(!empty( $videos )) { | ||
14 | + ?> | ||
15 | + <div class="video-performer-wrapper style"> | ||
16 | + <div class="gallery-title">Видео: <?= count($videos) ?></div> | ||
17 | + <div class="slider-video-wr"> | ||
18 | + <div id="demo5" class="scroll-img video-slider"> | ||
19 | + <ul> | ||
20 | + <?php foreach($videos as $video): ?> | ||
21 | + <li> | ||
22 | + <div class="iframe-video"> | ||
23 | + <iframe width="560" height="320" src="<?= $video[ 'youtube' ] ?>" frameborder="0" allowfullscreen></iframe> | ||
24 | + </div> | ||
22 | 25 | ||
23 | - <a href="#"></a><span></span> | ||
24 | - </li> | ||
25 | - <?php endforeach; ?> | 26 | + <a href="#"></a><span></span> |
27 | + </li> | ||
28 | + <?php endforeach; ?> | ||
26 | 29 | ||
27 | - </ul> | ||
28 | - </div> | ||
29 | - <div id="demo5-btn" class="text-center"> | ||
30 | - <button class="btn" id="demo5-backward"></button> | ||
31 | - <button class="btn" id="demo5-forward"></button> | 30 | + </ul> |
31 | + </div> | ||
32 | + <div id="demo5-btn" class="text-center"> | ||
33 | + <button class="btn" id="demo5-backward"></button> | ||
34 | + <button class="btn" id="demo5-forward"></button> | ||
35 | + </div> | ||
36 | + </div> | ||
32 | </div> | 37 | </div> |
33 | - </div> | ||
34 | - | ||
35 | - | ||
36 | -</div> | 38 | + <?php |
39 | + } | ||
40 | +?> | ||
37 | <div class="gallery-performer-wrapper style"> | 41 | <div class="gallery-performer-wrapper style"> |
38 | <div class="gallery-performer-margin"> | 42 | <div class="gallery-performer-margin"> |
39 | <?= ListView::widget([ | 43 | <?= ListView::widget([ |
@@ -50,7 +54,9 @@ | @@ -50,7 +54,9 @@ | ||
50 | { | 54 | { |
51 | $('#demo5').scrollbox( | 55 | $('#demo5').scrollbox( |
52 | { | 56 | { |
53 | - direction : 'h', distance : 220, autoPlay : false | 57 | + direction : 'h', |
58 | + distance : 220, | ||
59 | + autoPlay : false | ||
54 | } | 60 | } |
55 | ); | 61 | ); |
56 | $('#demo5-backward').click( | 62 | $('#demo5-backward').click( |
frontend/views/site/index.php
1 | <?php | 1 | <?php |
2 | - use frontend\models\ValidateHelper; | ||
3 | use \yii\helpers\Html; | 2 | use \yii\helpers\Html; |
4 | use \common\models\Specialization; | 3 | use \common\models\Specialization; |
5 | - | ||
6 | /** | 4 | /** |
7 | * @var $this yii\web\View | 5 | * @var $this yii\web\View |
8 | * @var $specializations common\models\Specialization | 6 | * @var $specializations common\models\Specialization |
9 | */ | 7 | */ |
10 | - | ||
11 | $this->title = 'My Yii Application'; | 8 | $this->title = 'My Yii Application'; |
12 | ?> | 9 | ?> |
13 | <div class="section-box-1"> | 10 | <div class="section-box-1"> |
frontend/web/css/style.css
@@ -7838,7 +7838,7 @@ input.disabled.admin-check:checked + label, input.disabled.admin-check:checked + | @@ -7838,7 +7838,7 @@ input.disabled.admin-check:checked + label, input.disabled.admin-check:checked + | ||
7838 | background: #fff | 7838 | background: #fff |
7839 | } | 7839 | } |
7840 | 7840 | ||
7841 | -.field_list .help-block { | 7841 | +.field_list .help-block, .admin-avatar .help-block { |
7842 | float: left; | 7842 | float: left; |
7843 | } | 7843 | } |
7844 | 7844 |