Commit 2e35d6bdfdf36060d255c7ffab7d728615be0250
1 parent
65ef9266
test
Showing
7 changed files
with
83 additions
and
18 deletions
Show diff stats
common/models/Portfolio.php
... | ... | @@ -22,6 +22,7 @@ |
22 | 22 | * @property string $description |
23 | 23 | * @property string $cover |
24 | 24 | * @property integer $gallery_id |
25 | + * @property string $preview | |
25 | 26 | * @property PortfolioSpecialization[] $portfolioSpecializations |
26 | 27 | * @property Specialization[] $specializations |
27 | 28 | */ |
... | ... | @@ -65,6 +66,7 @@ |
65 | 66 | [ |
66 | 67 | [ |
67 | 68 | 'name', |
69 | + 'preview', | |
68 | 70 | ], |
69 | 71 | 'required', |
70 | 72 | ], |
... | ... | @@ -94,6 +96,13 @@ |
94 | 96 | ], |
95 | 97 | [ |
96 | 98 | [ |
99 | + 'preview', | |
100 | + ], | |
101 | + 'string', | |
102 | + 'max' => 1000, | |
103 | + ], | |
104 | + [ | |
105 | + [ | |
97 | 106 | 'specializationInput', |
98 | 107 | ], |
99 | 108 | 'safe', |
... | ... | @@ -167,4 +176,9 @@ |
167 | 176 | { |
168 | 177 | $this->specializationString = $value; |
169 | 178 | } |
179 | + | |
180 | + public function getGallery() | |
181 | + { | |
182 | + $this->hasOne(Gallery::className(), ['gallery_id' => 'gallery_id']); | |
183 | + } | |
170 | 184 | } | ... | ... |
common/models/User.php
common/models/Vacancy.php
common/widgets/views/phone_field.php
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | <?= Html::beginTag('div',['class'=>'form-group','id'=>isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ])?> |
21 | 21 | <div class="input-blocks"> |
22 | 22 | <label for="cont-phone-<?= ++$label ?>">ะขะตะปะตัะพะฝ</label> |
23 | - <input id="cont-phone-<?= $label ?>" type="tel" pattern="^\+?(?:\d{0,3})?[\(\s]?\d{0,5}[\)\s]?\d{3}[-\s]?\d{2}[-\s]?\d{2}$" placeholder="" class="form-control custom-input-2" value="<?= isset($model[$t]['value']) ? $model[$t]['value'] : '' ?>" name="Fields[phone][<?=$row?>][0][phone]" /> | |
23 | + <input id="cont-phone-<?= $label ?>" type="tel" pattern="^\+?(?:\d{0,3})?[\(\s]?\d{0,5}[\)\s]?\d{3}[-\s]?\d{2}[-\s]?\d{2}$" placeholder="+xx(xxx)xxx-xx-xx" class="form-control custom-input-2" value="<?= isset($model[$t]['value']) ? $model[$t]['value'] : '' ?>" name="Fields[phone][<?=$row?>][0][phone]" /> | |
24 | 24 | </div> |
25 | 25 | <span data-id="<?= isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ?>" title="ัะดะฐะปะธัั" class="glyphicon glyphicon-trash delete-field-item"></span> |
26 | 26 | <?= Html::endTag('div')?> |
... | ... | @@ -42,7 +42,7 @@ |
42 | 42 | var sub_block = '<div class="form-group" >'+ |
43 | 43 | '<div class="input-blocks">'+ |
44 | 44 | '<label for="cont-phone-' + ++start_label_<?=$this->context->id?> +'">ะขะตะปะตัะพะฝ</label>'+ |
45 | - '<input id="cont-phone-' + start_label_<?=$this->context->id?> +'" type="tel" pattern="^\\+?(?:\\d{0,3})?[\\(\\s]?\\d{0,5}[\\)\\s]?\\d{3}[-\\s]?\\d{2}[-\\s]?\\d{2}$" placeholder="" class="form-control custom-input-2" value="" name="Fields[phone]['+ start_i_<?=$this->context->id?>++ +'][0][phone]" />'+ | |
45 | + '<input id="cont-phone-' + start_label_<?=$this->context->id?> +'" type="tel" pattern="^\\+?(?:\\d{0,3})?[\\(\\s]?\\d{0,5}[\\)\\s]?\\d{3}[-\\s]?\\d{2}[-\\s]?\\d{2}$" placeholder="+xx(xxx)xxx-xx-xx" class="form-control custom-input-2" value="" name="Fields[phone]['+ start_i_<?=$this->context->id?>++ +'][0][phone]" />'+ | |
46 | 46 | '</div>'+ |
47 | 47 | '<span class="glyphicon glyphicon-trash delete-field-item custom-remove-ico"></span>'+ |
48 | 48 | '<div>'; | ... | ... |
frontend/controllers/AccountsController.php
... | ... | @@ -336,8 +336,10 @@ |
336 | 336 | */ |
337 | 337 | public function actionGalleryUpdate($id) |
338 | 338 | { |
339 | - $gallery = Gallery::findOne($id); | |
340 | 339 | $user = \Yii::$app->user->identity; |
340 | + $gallery = $user->getGalleries() | |
341 | + ->where([ 'gallery_id' => $id ]) | |
342 | + ->one(); | |
341 | 343 | $post = \Yii::$app->request->post(); |
342 | 344 | if($gallery->load($post) && $gallery->save()) { |
343 | 345 | return $this->redirect([ |
... | ... | @@ -462,11 +464,20 @@ |
462 | 464 | */ |
463 | 465 | public function actionPortfolioCreate() |
464 | 466 | { |
467 | + $user = \Yii::$app->user->identity; | |
465 | 468 | $portfolio = new Portfolio(); |
466 | 469 | $specializations = Specialization::find() |
467 | 470 | ->where([ 'specialization_pid' => 0 ]) |
468 | 471 | ->orderBy('specialization_id') |
469 | 472 | ->all(); |
473 | + $galleries = $user->getGalleries() | |
474 | + ->select([ | |
475 | + 'name', | |
476 | + 'gallery_id', | |
477 | + ]) | |
478 | + ->asArray() | |
479 | + ->indexBy('gallery_id') | |
480 | + ->column(); | |
470 | 481 | $post = \Yii::$app->request->post(); |
471 | 482 | if(!empty( $post )) { |
472 | 483 | $portfolio->load($post); |
... | ... | @@ -483,6 +494,7 @@ |
483 | 494 | return $this->render('_portfolio_form', [ |
484 | 495 | 'portfolio' => $portfolio, |
485 | 496 | 'specializations' => $specializations, |
497 | + 'galleries' => $galleries, | |
486 | 498 | ]); |
487 | 499 | } |
488 | 500 | |
... | ... | @@ -500,6 +512,14 @@ |
500 | 512 | $portfolio = $user->getPortfolios() |
501 | 513 | ->where([ 'portfolio_id' => $id ]) |
502 | 514 | ->one(); |
515 | + $galleries = $user->getGalleries() | |
516 | + ->select([ | |
517 | + 'name', | |
518 | + 'gallery_id', | |
519 | + ]) | |
520 | + ->asArray() | |
521 | + ->indexBy('gallery_id') | |
522 | + ->column(); | |
503 | 523 | if(!$portfolio instanceof ActiveRecord) { |
504 | 524 | throw new NotFoundHttpException('ะะฐะฟะธัั ะฝะต ะฝะฐะนะดะตะฝะฐ'); |
505 | 525 | } |
... | ... | @@ -527,6 +547,7 @@ |
527 | 547 | return $this->render('_portfolio_form', [ |
528 | 548 | 'portfolio' => $portfolio, |
529 | 549 | 'specializations' => $specializations, |
550 | + 'galleries' => $galleries, | |
530 | 551 | ]); |
531 | 552 | } |
532 | 553 | ... | ... |
frontend/views/accounts/_portfolio_form.php
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | /** |
3 | 3 | * @var Portfolio $portfolio |
4 | 4 | * @var integer[] $specializations |
5 | + * @var string[] $galleries | |
5 | 6 | */ |
6 | 7 | use common\models\Option; |
7 | 8 | use common\models\Portfolio; |
... | ... | @@ -60,14 +61,14 @@ |
60 | 61 | <li> |
61 | 62 | <a href="#" title="<?= $child_second->specialization_name ?>"> |
62 | 63 | <?= $form->field($portfolio, "specializationInput[{$child_second->specialization_id}]", [ |
63 | - 'template' => '{input}{label}{hint}{error}', | |
64 | + 'template' => '{input}{label}{hint}{error}', | |
64 | 65 | ]) |
65 | 66 | ->label('<span></span>' . $child_second->specialization_name) |
66 | 67 | ->checkbox([ |
67 | 68 | 'value' => $child_second->specialization_id, |
68 | 69 | 'label' => NULL, |
69 | 70 | 'uncheck' => NULL, |
70 | - 'class' => 'custom-check', | |
71 | + 'class' => 'custom-check', | |
71 | 72 | ], false) ?> |
72 | 73 | </a> |
73 | 74 | </li> |
... | ... | @@ -98,9 +99,12 @@ |
98 | 99 | ]); ?> |
99 | 100 | </div> |
100 | 101 | |
101 | - <div class="input-blocks-wrapper admin-avatar admin-blog-min-img admin-portfolio-foto"> | |
102 | - <div style="font-size: 13px;color: inherit;font-weight: 700;color: red">ะคะพัะพะณะฐะปะตัะตั</div> | |
103 | - | |
102 | + <div class="input-blocks-wrapper"> | |
103 | + <div class="input-blocks admin-project-list admin-currency-second"> | |
104 | + <?= $form->field($portfolio, 'gallery_id') | |
105 | + ->hint("<p>ะะปั ัะพะทะดะฐะฝะธั ะณะฐะปะตัะตะธ ะฟะตัะตะนะดะธัะต ะฟะพ " . Html::a('ัััะปะบะต', [ 'accounts/gallery-create' ], [ 'target' => '_BLANK' ]) . "</p>") | |
106 | + ->dropDownList($galleries, [ 'prompt' => 'ะัะฑะตัะธัะต ะณะฐะปะตัะตั' ]) ?> | |
107 | + </div> | |
104 | 108 | </div> |
105 | 109 | |
106 | 110 | <div class="input-blocks-wrapper"> |
... | ... | @@ -137,6 +141,12 @@ |
137 | 141 | </div> |
138 | 142 | </div> |
139 | 143 | |
144 | + <div class="input-blocks-wrapper full-blocks admin-editor-bl"> | |
145 | + <div class="input-blocks"> | |
146 | + <?= $form->field($portfolio, 'preview') | |
147 | + ->widget(CKEditor::className(), [ 'editorOptions' => [ 'preset' => 'basic' ] ]) ?> | |
148 | + </div> | |
149 | + </div> | |
140 | 150 | |
141 | 151 | <div class="input-blocks-wrapper full-blocks admin-editor-bl"> |
142 | 152 | <div class="input-blocks"> | ... | ... |
frontend/views/performer/_portfolio_list_view.php
1 | 1 | <?php |
2 | -use yii\helpers\ArrayHelper; | |
3 | -use yii\helpers\Html; | |
4 | -use yii\helpers\StringHelper; | |
5 | - | |
2 | + /** | |
3 | + * @var Portfolio $model | |
4 | + */ | |
5 | + use common\models\Portfolio; | |
6 | + use yii\helpers\ArrayHelper; | |
7 | + use yii\helpers\Html; | |
8 | + use yii\helpers\StringHelper; | |
6 | 9 | |
7 | 10 | ?> |
8 | 11 | <div class="portfolio-project-blocks-wr"> |
9 | 12 | <div class="portfolio-project-blocks-img-title"> |
10 | 13 | <div class="portfolio-project-blocks-img"> |
11 | - <?= Html::a(Html::img($model->cover), '#');?> | |
14 | + <?= Html::a(Html::img($model->cover), '#'); ?> | |
12 | 15 | </div> |
13 | 16 | <div class="portfolio-project-blocks-title-wr"> |
14 | 17 | <div class="portfolio-project-blocks-title"> |
15 | - <a href="#"><?= $model->name?></a> | |
18 | + <?= Html::a($model->name, [ | |
19 | + 'performer/portfolio-view', | |
20 | + 'performer_id' => \Yii::$app->user->getId(), | |
21 | + 'portfolio_id' => $model->portfolio_id, | |
22 | + ]) ?> | |
16 | 23 | </div> |
17 | 24 | </div> |
18 | 25 | </div> |
19 | 26 | <div class="portfolio-project-views-wr"> |
20 | 27 | <div class="portfolio-project-views ico-views-bl"> |
21 | 28 | <div class="portfolio-project-views-img-wr"> |
22 | - <div class="portfolio-project-views-img"><img src="/images/portfolio-project/ico-1.png"/></div> | |
29 | + <div class="portfolio-project-views-img"> | |
30 | + <img src="/images/portfolio-project/ico-1.png"/></div> | |
23 | 31 | </div> |
24 | 32 | <div class="portfolio-project-views-txt">127</div> |
25 | 33 | </div> |
26 | 34 | <div class="portfolio-project-rati ico-views-bl"> |
27 | 35 | <div class="portfolio-project-views-img-wr"> |
28 | - <div class="portfolio-project-views-img"><img src="/images/portfolio-project/ico-2.png"/></div> | |
36 | + <div class="portfolio-project-views-img"> | |
37 | + <img src="/images/portfolio-project/ico-2.png"/></div> | |
29 | 38 | </div> |
30 | 39 | <div class="portfolio-project-views-txt">10.0</div> |
31 | 40 | </div> |
32 | 41 | <div class="ico-views-bl"> |
33 | 42 | <div class="portfolio-project-views-img-wr"> |
34 | - <div class="portfolio-project-views-img"><img src="/images/portfolio-project/ico-3.png"/></div> | |
43 | + <div class="portfolio-project-views-img"> | |
44 | + <img src="/images/portfolio-project/ico-3.png"/></div> | |
35 | 45 | </div> |
36 | 46 | <div class="portfolio-project-views-txt">14</div> |
37 | 47 | </div> |
38 | 48 | </div> |
39 | - <div class="portfolio-project-blocks-tags"><?= StringHelper::truncate(implode(', ',ArrayHelper::getColumn($model->specializations,'specialization_name')),20)?></div> | |
49 | + <div class="portfolio-project-blocks-tags"><?= StringHelper::truncate(implode(', ', ArrayHelper::getColumn($model->specializations, 'specialization_name')), 20) ?></div> | |
40 | 50 | </div> |
41 | 51 | \ No newline at end of file | ... | ... |