_gallery_form.php
3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
/**
* @var Gallery $gallery
* @var User $user
*/
use common\components\Request;
use common\models\Gallery;
use common\models\User;
use common\modules\file\widgets\ImageUploader;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
$this->title = 'Галерея Фото';
$this->params[ 'breadcrumbs' ][] = $this->title;
?>
<div class="login-left-column-title"><?= $this->title ?></div>
<?php
$form = ActiveForm::begin();
?>
<div class="input-blocks-wrapper full-blocks data-block">Дата создания: <?= $gallery->date_add ?></div>
<div class="login-left-column-title-two admin-gallery-photo-edit style">Редактирование:</div>
<div class="input-blocks-wrapper">
<div class="input-blocks">
<?= $form->field($gallery, 'name')
->textInput([ 'class' => 'custom-input-2' ]) ?>
</div>
</div>
<div class="input-blocks-wrapper admin-avatar amin-team-foto">
<?= ImageUploader::widget([
'model' => $gallery,
'field' => 'cover',
'size' => [
[
'width' => 210,
'height' => 150,
],
],
'remover' => true,
'multi' => false,
'gallery' => $gallery->cover,
'name' => 'Загрузить главное фото',
]); ?>
<div class="help-block"></div>
<?php
$client = '';
foreach($gallery->getActiveValidators('cover') as $validator) {
$client .= $validator->clientValidateAttribute($gallery, 'cover', $this);
}
$js = "
$('#".$form->id."').yiiActiveForm(
'add', {
container : '.admin-avatar',
error : '.help-block',
id : 'gallery-cover',
input : '#gallery-cover',
name : 'Gallery[cover]',
validate: function(attribute, value, messages, deferred) { ".$client." }
}
);
";
$this->registerJs($js, $this::POS_LOAD);
?>
</div>
<div class="admin-gallery-photos-load-wr style">
<?= ImageUploader::widget([
'model' => $gallery,
'field' => 'photo',
'size' => [
[
'width' => 152,
'height' => 108,
],
],
'multi' => true,
'gallery' => $gallery->photo,
'name' => 'Загрузить фото галереи',
]); ?>
</div>
<div class="input-blocks-wrapper">
<div class="admin-save-btn skills-save-btn admin-add-remove-wr style">
<?= Html::submitButton($gallery->isNewRecord ? Yii::t('app', 'add') : 'Обновить', [ 'class' => 'input-blocks-wrapper button' ]) ?>
<div class="admin-remove-note">
<?php
if(!$gallery->isNewRecord) {
echo Html::a(Yii::t('app', 'delete'), [
'accounts/gallery-delete',
'id' => $gallery->gallery_id,
], [
'title' => Yii::t('app', 'delete'),
'aria-label' => Yii::t('app', 'delete'),
'data-confirm' => Yii::t('app', 'delete_confirm'),
'data-method' => 'post',
'data-pjax' => 0,
]);
}
?>
</div>
<div class="admin-back-note">
<?= Html::a('вернуться', Request::getIsLocal(\Yii::$app->request->referrer) ? \Yii::$app->request->referrer : [ 'accounts/gallery' ]) ?>
</div>
</div>
</div>
<?php
$form->end();
?>