593851ec
Alexey Boroda
First commit
|
1
2
|
<?php
|
ba196ec2
Alexey Boroda
-Blog in process
|
3
4
5
6
7
|
use artbox\weblog\models\Article;
use artbox\weblog\models\ArticleLang;
// use artweb\artbox\blog\models\BlogCategory;
// use artweb\artbox\blog\models\BlogTag;
|
593851ec
Alexey Boroda
First commit
|
8
|
use kartik\select2\Select2;
|
ba196ec2
Alexey Boroda
-Blog in process
|
9
|
use noam148\imagemanager\components\ImageManagerInputWidget;
|
593851ec
Alexey Boroda
First commit
|
10
11
12
13
|
use yii\helpers\Html;
use yii\helpers\Url;
use yii\web\View;
use yii\widgets\ActiveForm;
|
ba196ec2
Alexey Boroda
-Blog in process
|
14
|
use artbox\core\widgets\LanguageForm;
|
593851ec
Alexey Boroda
First commit
|
15
16
17
|
use yii\web\JsExpression;
/**
|
ba196ec2
Alexey Boroda
-Blog in process
|
18
19
20
21
22
23
24
25
|
* @var View $this
* @var Article $model
* @var ActiveForm $form
* @var ArticleLang[] $modelLangs
* @var BlogCategory[] $categories
* @var BlogTag[] $tags
* @var array $products
* @var array $articles
|
593851ec
Alexey Boroda
First commit
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
*/
?>
<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
|
41
|
'formView' => '@artbox/weblog/views/blog-article/_form_language',
|
593851ec
Alexey Boroda
First commit
|
42
43
44
45
46
47
|
'form' => $form,
]
);
?>
<?php
|
ba196ec2
Alexey Boroda
-Blog in process
|
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
// echo $form->field($model, 'blogCategories')
// ->widget(
// Select2::className(),
// [
// 'data' => $categories,
// 'theme' => Select2::THEME_BOOTSTRAP,
// 'options' => [
// 'placeholder' => \Yii::t('blog', 'Select category'),
// 'multiple' => true,
// ],
// 'pluginOptions' => [
// 'allowClear' => true,
// ],
// ]
// );
|
593851ec
Alexey Boroda
First commit
|
63
64
65
|
?>
<?php
|
ba196ec2
Alexey Boroda
-Blog in process
|
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
// echo $form->field($model, 'blogTags')
// ->widget(
// Select2::className(),
// [
// 'data' => $tags,
// 'theme' => Select2::THEME_BOOTSTRAP,
// 'options' => [
// 'placeholder' => \Yii::t('blog', 'Select tag'),
// 'multiple' => true,
// ],
// 'pluginOptions' => [
// 'allowClear' => true,
// ],
// ]
// );
|
593851ec
Alexey Boroda
First commit
|
81
82
|
?>
|
ba196ec2
Alexey Boroda
-Blog in process
|
83
|
<?= $form->field($model, 'image_id')
|
593851ec
Alexey Boroda
First commit
|
84
|
->widget(
|
ba196ec2
Alexey Boroda
-Blog in process
|
85
|
ImageManagerInputWidget::className(),
|
593851ec
Alexey Boroda
First commit
|
86
|
[
|
ba196ec2
Alexey Boroda
-Blog in process
|
87
88
89
90
91
92
|
'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
|
93
94
95
96
|
]
); ?>
<?php
|
ba196ec2
Alexey Boroda
-Blog in process
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
// echo $form->field($model, 'products')
// ->widget(
// Select2::className(),
// [
// 'data' => $products,
// 'options' => [
// 'placeholder' => \Yii::t('blog', 'Select related products'),
// 'multiple' => true,
// ],
// 'pluginOptions' => [
// 'allowClear' => true,
// 'minimumInputLength' => 3,
// 'language' => [
// 'errorLoading' => new JsExpression(
// "function () { return '" . \Yii::t('blog', 'Waiting for results') . "'; }"
// ),
// ],
// 'ajax' => [
// 'url' => yii\helpers\Url::to([ '/blog/blog-article/product-list' ]),
// 'dataType' => 'json',
// 'data' => new JsExpression('function(params) { return {q:params.term}; }'),
// ],
// 'templateResult' => new JsExpression('function(product) { return product.text; }'),
// 'templateSelection' => new JsExpression('function (product) { return product.text; }'),
// ],
// ]
// );
|
593851ec
Alexey Boroda
First commit
|
124
125
126
|
?>
<?php
|
ba196ec2
Alexey Boroda
-Blog in process
|
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
157
158
159
160
|
// if (empty( $model->id )) {
// $data = 'function(params) { return {q:params.term}; }';
// } else {
// $data = 'function(params) { return {q:params.term, id:' . $model->id . '}; }';
// }
// echo $form->field($model, 'blogArticles')
// ->widget(
// Select2::className(),
// [
// 'data' => $articles,
// 'options' => [
// 'placeholder' => \Yii::t('blog', 'Select related articles'),
// 'multiple' => true,
// ],
// 'pluginOptions' => [
// 'allowClear' => true,
// 'minimumInputLength' => 3,
// 'language' => [
// 'errorLoading' => new JsExpression(
// "function () { return '" . \Yii::t('blog', 'Waiting for results') . "'; }"
// ),
// ],
// 'ajax' => [
// 'url' => yii\helpers\Url::to([ '/blog/blog-article/article-list' ]),
// 'dataType' => 'json',
// 'data' => new JsExpression(
// $data
// ),
// ],
// 'templateResult' => new JsExpression('function(article) { return article.text; }'),
// 'templateSelection' => new JsExpression('function (article) { return article.text; }'),
// ],
// ]
// );
|
593851ec
Alexey Boroda
First commit
|
161
162
163
164
165
166
|
?>
<?= $form->field($model, 'sort')
->textInput() ?>
<?= $form->field($model, 'status')
|
ba196ec2
Alexey Boroda
-Blog in process
|
167
168
169
170
171
|
->checkbox(
[
'class' => 'flat',
]
) ?>
|
593851ec
Alexey Boroda
First commit
|
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
<?= $form->field($model, 'author_id')
->textInput() ?>
<div class="form-group">
<?= Html::submitButton(
$model->isNewRecord ? 'Create' : 'Update',
[ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]
) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
|