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
common/modules/file/widgets/views/image_sizer.php
... | ... | @@ -4,7 +4,6 @@ |
4 | 4 | $field_name = mb_strtolower($model->formName()) . "-" . $field; |
5 | 5 | |
6 | 6 | $id = $model->tableSchema->primaryKey[ 0 ]; |
7 | - | |
8 | 7 | ?> |
9 | 8 | <div class="file-uploader-block"> |
10 | 9 | <?php if(!$multi): ?> |
... | ... | @@ -40,7 +39,6 @@ |
40 | 39 | $( |
41 | 40 | function() |
42 | 41 | { |
43 | - | |
44 | 42 | $("#<?= $field?>").fileupload( |
45 | 43 | { |
46 | 44 | dataType : 'json', formData : {size : '<?= json_encode($size)?>'}, |
... | ... | @@ -66,7 +64,7 @@ |
66 | 64 | block.append(img); |
67 | 65 | block.parents('.file-uploader-block').parent() |
68 | 66 | .addClass('success_download'); |
69 | - $("#<?=$field_name?>").val(data.result.link); | |
67 | + $("#<?=$field_name?>").val(data.result.link).trigger('change'); | |
70 | 68 | $("#<?=$field?>_new_img").val(data.result.link); |
71 | 69 | } |
72 | 70 | } |
... | ... | @@ -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 | 99 | .removeClass('success_download'); |
102 | 100 | $("#<?= $field?>_img_block").parent().parent().find('.admin-ava-wr') |
103 | 101 | .remove(); |
104 | - | |
102 | + if($(this).hasClass('remover_image')) { | |
103 | + $('#<?=$field?>_new_img').val(''); | |
104 | + } | |
105 | 105 | $("#<?=$field?>_buttons_block").remove(); |
106 | 106 | var old_url = $('#<?=$field?>_old_img').val(); |
107 | 107 | var new_url = $('#<?=$field?>_new_img').val(); |
... | ... | @@ -112,10 +112,16 @@ |
112 | 112 | ); |
113 | 113 | <?php |
114 | 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 | 123 | } else { |
118 | - echo "$(\"#$field_name\").val(old_url); | |
124 | + echo "$(\"#$field_name\").val(old_url).trigger('change'); | |
119 | 125 | if(old_url.length<=1){ |
120 | 126 | $('#{$field}_img_block').find('img').remove() |
121 | 127 | } | ... | ... |
frontend/controllers/AjaxController.php
... | ... | @@ -27,6 +27,9 @@ |
27 | 27 | public function actionProjectUser() |
28 | 28 | { |
29 | 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 | 33 | $model = new UserSearch(); |
31 | 34 | $dataProvider = $model->search(\Yii::$app->request->queryParams); |
32 | 35 | $dataProvider->query->andFilterWhere([ | ... | ... |
frontend/controllers/PerformerController.php
... | ... | @@ -335,7 +335,7 @@ |
335 | 335 | } |
336 | 336 | |
337 | 337 | $gallery = new ActiveDataProvider([ |
338 | - 'query' => $user->getGalleries(), | |
338 | + 'query' => $user->getGalleries()->andWhere(['not', ['photo' => '']])->andWhere(['not', ['photo' => NULL]]), | |
339 | 339 | 'pagination' => [ |
340 | 340 | 'pageSize' => 5, |
341 | 341 | ], | ... | ... |
frontend/views/accounts/_gallery_form.php
1 | 1 | <?php |
2 | 2 | /** |
3 | 3 | * @var Gallery $gallery |
4 | - * @var User $user | |
4 | + * @var User $user | |
5 | 5 | */ |
6 | 6 | use common\components\Request; |
7 | 7 | use common\models\Gallery; |
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | <div class="input-blocks-wrapper"> |
25 | 25 | <div class="input-blocks"> |
26 | 26 | <?= $form->field($gallery, 'name') |
27 | - ->textInput (['class'=> 'custom-input-2']) ?> | |
27 | + ->textInput([ 'class' => 'custom-input-2' ]) ?> | |
28 | 28 | </div> |
29 | 29 | </div> |
30 | 30 | |
... | ... | @@ -32,27 +32,47 @@ |
32 | 32 | <?= ImageUploader::widget([ |
33 | 33 | 'model' => $gallery, |
34 | 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 | 42 | 'multi' => false, |
43 | 43 | 'gallery' => $gallery->cover, |
44 | 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 | 66 | </div> |
47 | 67 | <div class="admin-gallery-photos-load-wr style"> |
48 | 68 | <?= ImageUploader::widget([ |
49 | 69 | 'model' => $gallery, |
50 | 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 | 77 | 'multi' => true, |
58 | 78 | 'gallery' => $gallery->photo, |
... | ... | @@ -61,29 +81,28 @@ |
61 | 81 | </div> |
62 | 82 | |
63 | 83 | |
64 | - | |
65 | 84 | <div class="input-blocks-wrapper"> |
66 | 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 | 87 | <div class="admin-remove-note"> |
69 | 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 | 102 | </div> |
84 | 103 | |
85 | 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 | 106 | </div> |
88 | 107 | </div> |
89 | 108 | </div> | ... | ... |
frontend/views/company/gallery.php
frontend/views/layouts/gallery.php
... | ... | @@ -74,6 +74,7 @@ |
74 | 74 | 'performer_id' => $this->params[ 'user' ]->id, |
75 | 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 | 80 | 'label' => 'ะะฐะบะฐะทะฐะฝะฝัะต ัะฐะฑะพัั', |
... | ... | @@ -82,6 +83,7 @@ |
82 | 83 | 'performer_id' => $this->params[ 'user' ]->id, |
83 | 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 | 89 | 'label' => 'ะะปะพะณ', | ... | ... |
frontend/views/performer/gallery.php
... | ... | @@ -9,31 +9,35 @@ |
9 | 9 | $this->params[ 'user' ] = $user; |
10 | 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 | 37 | </div> |
33 | - </div> | |
34 | - | |
35 | - | |
36 | -</div> | |
38 | + <?php | |
39 | + } | |
40 | +?> | |
37 | 41 | <div class="gallery-performer-wrapper style"> |
38 | 42 | <div class="gallery-performer-margin"> |
39 | 43 | <?= ListView::widget([ |
... | ... | @@ -50,7 +54,9 @@ |
50 | 54 | { |
51 | 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 | 62 | $('#demo5-backward').click( | ... | ... |
frontend/views/site/index.php
1 | 1 | <?php |
2 | - use frontend\models\ValidateHelper; | |
3 | 2 | use \yii\helpers\Html; |
4 | 3 | use \common\models\Specialization; |
5 | - | |
6 | 4 | /** |
7 | 5 | * @var $this yii\web\View |
8 | 6 | * @var $specializations common\models\Specialization |
9 | 7 | */ |
10 | - | |
11 | 8 | $this->title = 'My Yii Application'; |
12 | 9 | ?> |
13 | 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 | 7838 | background: #fff |
7839 | 7839 | } |
7840 | 7840 | |
7841 | -.field_list .help-block { | |
7841 | +.field_list .help-block, .admin-avatar .help-block { | |
7842 | 7842 | float: left; |
7843 | 7843 | } |
7844 | 7844 | ... | ... |