593851ec
Alexey Boroda
First commit
|
1
2
|
<?php
|
933c16cb
Yarik
Pre stable ready
|
3
|
use artbox\core\components\imagemanager\components\ImageManagerInputWidget;
|
ba196ec2
Alexey Boroda
-Blog in process
|
4
5
|
use artbox\weblog\models\Article;
use artbox\weblog\models\ArticleLang;
|
ee588281
Alexey Boroda
-Blog backend ready
|
6
7
|
use artbox\weblog\models\Category;
use artbox\weblog\models\Tag;
|
593851ec
Alexey Boroda
First commit
|
8
|
use kartik\select2\Select2;
|
593851ec
Alexey Boroda
First commit
|
9
10
11
12
|
use yii\helpers\Html;
use yii\helpers\Url;
use yii\web\View;
use yii\widgets\ActiveForm;
|
ba196ec2
Alexey Boroda
-Blog in process
|
13
|
use artbox\core\widgets\LanguageForm;
|
593851ec
Alexey Boroda
First commit
|
14
15
16
|
use yii\web\JsExpression;
/**
|
ee588281
Alexey Boroda
-Blog backend ready
|
17
18
19
20
21
22
23
24
|
* @var View $this
* @var Article $model
* @var ActiveForm $form
* @var ArticleLang[] $modelLangs
* @var Category[] $categories
* @var Tag[] $tags
* @var array $products
* @var array $articles
|
593851ec
Alexey Boroda
First commit
|
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
*/
?>
<div class="blog-article-form">
<?php $form = ActiveForm::begin(
[
'options' => [ 'enctype' => 'multipart/form-data' ],
]
); ?>
<?php
echo LanguageForm::widget(
[
'modelLangs' => $modelLangs,
|
ba196ec2
Alexey Boroda
-Blog in process
|
40
|
'formView' => '@artbox/weblog/views/blog-article/_form_language',
|
593851ec
Alexey Boroda
First commit
|
41
42
43
44
|
'form' => $form,
]
);
?>
|
ee588281
Alexey Boroda
-Blog backend ready
|
45
46
47
48
49
50
51
52
53
54
|
<div class="form-group">
<label class="control-label"><?= \Yii::t('blog', 'Categories'); ?></label>
<?php
echo Select2::widget(
[
'name' => 'categoryIds',
'options' => [
'placeholder' => \Yii::t('blog', 'Search for a categories ...'),
'multiple' => true,
|
7dbbfcac
Anastasia
all select
|
55
56
57
58
59
60
61
|
],
'value' => array_keys($model->categoryIds),
'data' => $model->categoryIds,
'toggleAllSettings' => [
'selectLabel' => false,
|
ee588281
Alexey Boroda
-Blog backend ready
|
62
|
],
|
7dbbfcac
Anastasia
all select
|
63
|
'pluginOptions' => [
|
ee588281
Alexey Boroda
-Blog backend ready
|
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
|
'allowClear' => true,
'minimumInputLength' => 3,
'language' => [
'errorLoading' => new JsExpression(
"function () { return 'Waiting for results...'; }"
),
],
'ajax' => [
'url' => Url::to([ '/blog-category/list' ]),
'dataType' => 'json',
'data' => new JsExpression(
'function(params) {
return {
q:params.term
};
}'
),
],
'escapeMarkup' => new JsExpression(
'function (markup) {
return markup;
}'
),
'templateResult' => new JsExpression(
'function (brand) {
return brand.text;
}'
),
'templateSelection' => new JsExpression(
'function (brand) {
return brand.text;
}'
),
],
]
);
?>
</div>
<div class="form-group">
<label class="control-label"><?= \Yii::t('blog', 'Tags'); ?></label>
<?php
echo Select2::widget(
[
|
7dbbfcac
Anastasia
all select
|
108
109
|
'name' => 'tagIds',
'options' => [
|
ee588281
Alexey Boroda
-Blog backend ready
|
110
111
112
|
'placeholder' => \Yii::t('blog', 'Search for a tags ...'),
'multiple' => true,
],
|
7dbbfcac
Anastasia
all select
|
113
114
115
116
117
118
|
'toggleAllSettings' => [
'selectLabel' => false,
],
'value' => array_keys($model->tagIds),
'data' => $model->tagIds,
'pluginOptions' => [
|
ee588281
Alexey Boroda
-Blog backend ready
|
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
'allowClear' => true,
'minimumInputLength' => 3,
'language' => [
'errorLoading' => new JsExpression(
"function () { return 'Waiting for results...'; }"
),
],
'ajax' => [
'url' => Url::to([ '/blog-tag/list' ]),
'dataType' => 'json',
'data' => new JsExpression(
'function(params) {
return {
q:params.term
};
}'
),
],
'escapeMarkup' => new JsExpression(
'function (markup) {
return markup;
}'
),
'templateResult' => new JsExpression(
'function (brand) {
return brand.text;
}'
),
'templateSelection' => new JsExpression(
'function (brand) {
return brand.text;
}'
),
],
]
);
?>
</div>
|
593851ec
Alexey Boroda
First commit
|
157
|
|
ba196ec2
Alexey Boroda
-Blog in process
|
158
|
<?= $form->field($model, 'image_id')
|
593851ec
Alexey Boroda
First commit
|
159
|
->widget(
|
ba196ec2
Alexey Boroda
-Blog in process
|
160
|
ImageManagerInputWidget::className(),
|
593851ec
Alexey Boroda
First commit
|
161
|
[
|
ba196ec2
Alexey Boroda
-Blog in process
|
162
163
164
165
166
167
|
'aspectRatio' => ( 16 / 9 ),
//set the aspect ratio
'showPreview' => true,
//false to hide the preview
'showDeletePickedImageConfirm' => false,
//on true show warning before detach image
|
593851ec
Alexey Boroda
First commit
|
168
169
|
]
); ?>
|
ee588281
Alexey Boroda
-Blog backend ready
|
170
171
172
173
174
175
176
177
178
179
180
|
<div class="form-group">
<label class="control-label"><?= \Yii::t('blog', 'Articles'); ?></label>
<?php
if ($model->isNewRecord) {
$condition = '';
} else {
$condition = ', id: ' . $model->id;
}
echo Select2::widget(
[
|
7dbbfcac
Anastasia
all select
|
181
182
|
'name' => 'articleIds',
'options' => [
|
ee588281
Alexey Boroda
-Blog backend ready
|
183
184
185
|
'placeholder' => \Yii::t('blog', 'Search for an articles ...'),
'multiple' => true,
],
|
7dbbfcac
Anastasia
all select
|
186
187
188
189
190
191
|
'toggleAllSettings' => [
'selectLabel' => false,
],
'value' => array_keys($model->articleIds),
'data' => $model->articleIds,
'pluginOptions' => [
|
ee588281
Alexey Boroda
-Blog backend ready
|
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
'allowClear' => true,
'minimumInputLength' => 3,
'language' => [
'errorLoading' => new JsExpression(
"function () { return 'Waiting for results...'; }"
),
],
'ajax' => [
'url' => Url::to([ '/blog-article/list' ]),
'dataType' => 'json',
'data' => new JsExpression(
'function(params) {
return {
q:params.term' . $condition . '
};
}'
),
],
'escapeMarkup' => new JsExpression(
'function (markup) {
return markup;
}'
),
'templateResult' => new JsExpression(
'function (brand) {
return brand.text;
}'
),
'templateSelection' => new JsExpression(
'function (brand) {
return brand.text;
}'
),
],
]
);
?>
</div>
|
d7bd5725
Yarik
Blog article to p...
|
230
231
232
233
234
235
236
237
|
<?php
if (class_exists('\artbox\catalog\models\Product')) {
?>
<div class="form-group">
<label class="control-label"><?= \Yii::t('blog', 'Products'); ?></label>
<?php
echo Select2::widget(
[
|
7dbbfcac
Anastasia
all select
|
238
239
|
'name' => 'productIds',
'options' => [
|
d7bd5725
Yarik
Blog article to p...
|
240
241
242
|
'placeholder' => \Yii::t('blog', 'Search for products ...'),
'multiple' => true,
],
|
7dbbfcac
Anastasia
all select
|
243
244
245
246
247
248
|
'toggleAllSettings' => [
'selectLabel' => false,
],
'value' => array_keys($model->productIds),
'data' => $model->productIds,
'pluginOptions' => [
|
d7bd5725
Yarik
Blog article to p...
|
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
|
'allowClear' => true,
'minimumInputLength' => 3,
'language' => [
'errorLoading' => new JsExpression(
"function () { return 'Waiting for results...'; }"
),
],
'ajax' => [
'url' => Url::to([ '/product/list' ]),
'dataType' => 'json',
'data' => new JsExpression(
'function(params) {
return {
q:params.term
};
}'
),
],
'escapeMarkup' => new JsExpression(
'function (markup) {
return markup;
}'
),
'templateResult' => new JsExpression(
'function (product) {
return product.text;
}'
),
'templateSelection' => new JsExpression(
'function (product) {
return product.text;
}'
),
],
]
);
?>
</div>
<?php
}
?>
|
593851ec
Alexey Boroda
First commit
|
290
291
292
293
294
|
<?= $form->field($model, 'sort')
->textInput() ?>
<?= $form->field($model, 'status')
|
ba196ec2
Alexey Boroda
-Blog in process
|
295
296
297
298
299
|
->checkbox(
[
'class' => 'flat',
]
) ?>
|
593851ec
Alexey Boroda
First commit
|
300
301
302
|
<?= $form->field($model, 'author_id')
->textInput() ?>
|
ee588281
Alexey Boroda
-Blog backend ready
|
303
304
305
306
307
308
309
|
<div class="form-group">
<?= Html::submitButton(
$model->isNewRecord ? 'Create' : 'Update',
[ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]
) ?>
</div>
|
593851ec
Alexey Boroda
First commit
|
310
311
312
313
|
<?php ActiveForm::end(); ?>
</div>
|