@ -10,6 +10,7 @@ use yii\helpers\Json;
use yii\helpers\ArrayHelper;
use kartik\widgets\DateTimePicker;
use kartik\widgets\Select2;
use common\modules\blog\helpers\BlogPostHelper;
/* @var $this yii\web\View */
/* @var $model \common\modules\blog\forms\BlogPostForm */
@ -37,108 +38,127 @@ JS;
'options' => ['enctype'=>'multipart/form-data']
]); ?>
< div class = "row" >
< div class = "col-md-6" >
< div class = "box box-default" >
< div class = "box-header with-border" > <? = Yii :: t ( 'blog' , 'Common' ) ?> </ div >
< div class = "box-body" >
<? = $form -> field ( $model , 'category_id' ) -> dropDownList ( $model -> categoriesList (), [ 'prompt' => '' ]) ?>
<? = $form -> field ( $model , 'published_at' ) -> widget ( DateTimePicker :: classname (), [
'options' => [],
'pluginOptions' => [
'autoclose' => true,
'format' => 'dd.mm.yyyy hh:ii:ss',
]
]); ?>
< / div >
< / div >
< / div >
< div class = "col-md-6" >
< div class = "box box-default" >
< div class = "box-header with-border" > <? = Yii :: t ( 'blog' , 'Tags' ) ?> </ div >
< div class = "box-body" >
<? = $form -> field ( $model -> tags , 'new_tags' ) -> widget ( Select2 :: classname (), [
'options' => [
'placeholder' => Yii::t('blog','Set tags...'),
'multiple' => true,
],
'pluginOptions' => [
'tags' => true,
'tokenSeparators' => [',', ' '],
'maximumInputLength' => 12,
'ajax' => [
'url' => $fetchUrl,
'dataType' => 'json',
'data' => new JsExpression('function(params) { return {q:params.term}; }')
],
'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
'templateResult' => new JsExpression('function(tag) { return tag.text; }'),
'templateSelection' => new JsExpression('function (tag) { return tag.text; }'),
],
])->label(false); ?>
< / div >
< / div >
< / div >
< / div >
< div class = "box box-default" >
< div class = "box-body" >
<? = $form -> field ( $model , 'title' ) -> textInput ([ 'maxlength' => true ]) ?>
<? = $form -> field ( $model , 'slug' ) -> textInput ([ 'maxlength' => true ]) ?>
<? = $form -> field ( $model , 'description' ) -> textarea ([ 'rows' => 5 ]) ?>
<? = $form -> field ( $model , 'content' ) -> widget ( CKEditor :: className ()) ?>
< / div >
< / div >
< div class = "box box-default" >
< div class = "box-body" >
< ul class = "nav nav-tabs" >
< li class = "active" >< a data-toggle = "tab" href = "#field_image" > <? = Yii :: t ( 'blog' , 'Image' ) ?> </ a ></ li >
< li >< a data-toggle = "tab" href = "#field_video" > <? = Yii :: t ( 'blog' , 'Video' ) ?> </ a ></ li >
< / ul >
< div class = "tab-content" >
< div id = "field_image" class = "tab-pane fade in active" style = "padding-top: 20px;" >
<? = $form -> field ( $model , 'image' ) -> label ( false ) -> widget ( FileInput :: class , [
'options' => [
'accept' => 'image/*',
],
'pluginOptions' => [
'showUpload' => false,
],
]) ?>
<?php if ( isset ( $model -> _post ) && $model -> _post -> image ) : ?>
<? = Html :: img ( $model -> _post -> getThumbFileUrl ( 'image' , 'thumb_gallery_view' ), [
'class' => 'thumbnail',
'width' => 300,
]) ?>
<? = $form -> field ( $model , 'reset_image' ) -> checkbox () ?>
<?php endif ; ?>
< / div >
< div id = "field_video" class = "tab-pane fade" style = "padding-top: 20px;" >
<? = $form -> field ( $model , 'video' ) -> textInput () -> label ( Yii :: t ( 'blog' , 'YouTube URL' )) -> hint ( Yii :: t ( 'blog' , 'If a video link is specified, the image will be used as a preview image' )) ?>
< div class = "row" >
< div class = "col-md-10" >
< div class = "row" >
< div class = "col-md-6" >
< div class = "box box-default" >
< div class = "box-header with-border" > <? = Yii :: t ( 'blog' , 'Common' ) ?> </ div >
< div class = "box-body" >
<? = $form -> field ( $model , 'category_id' ) -> dropDownList ( $model -> categoriesList (), [ 'prompt' => '' ]) ?>
<? = $form -> field ( $model , 'published_at' ) -> widget ( DateTimePicker :: classname (), [
'options' => [],
'pluginOptions' => [
'autoclose' => true,
'format' => 'dd.mm.yyyy hh:ii:ss',
]
]); ?>
< / div >
< / div >
< / div >
< div class = "col-md-6" >
< div class = "box box-default" >
< div class = "box-header with-border" > <? = Yii :: t ( 'blog' , 'Tags' ) ?> </ div >
< div class = "box-body" >
<? = $form -> field ( $model -> tags , 'new_tags' ) -> widget ( Select2 :: classname (), [
'options' => [
'placeholder' => Yii::t('blog','Set tags...'),
'multiple' => true,
],
'pluginOptions' => [
'tags' => true,
'tokenSeparators' => [',', ' '],
'maximumInputLength' => 12,
'ajax' => [
'url' => $fetchUrl,
'dataType' => 'json',
'data' => new JsExpression('function(params) { return {q:params.term}; }')
],
'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
'templateResult' => new JsExpression('function(tag) { return tag.text; }'),
'templateSelection' => new JsExpression('function (tag) { return tag.text; }'),
],
])->label(false); ?>
< / div >
< / div >
< / div >
< / div >
< div class = "box box-default" >
< div class = "box-body" >
<? = $form -> field ( $model , 'title' ) -> textInput ([ 'maxlength' => true ]) ?>
<? = $form -> field ( $model , 'slug' ) -> textInput ([ 'maxlength' => true ]) ?>
<? = $form -> field ( $model , 'description' ) -> textarea ([ 'rows' => 5 ]) ?>
<? = $form -> field ( $model , 'content' ) -> widget ( CKEditor :: className ()) ?>
< / div >
< / div >
< div class = "box box-default" >
< div class = "box-body" >
< ul class = "nav nav-tabs" >
< li class = "active" >< a data-toggle = "tab" href = "#field_image" > <? = Yii :: t ( 'blog' , 'Image' ) ?> </ a ></ li >
< li >< a data-toggle = "tab" href = "#field_video" > <? = Yii :: t ( 'blog' , 'Video' ) ?> </ a ></ li >
< / ul >
< div class = "tab-content" >
< div id = "field_image" class = "tab-pane fade in active" style = "padding-top: 20px;" >
<? = $form -> field ( $model , 'image' ) -> label ( false ) -> widget ( FileInput :: class , [
'options' => [
'accept' => 'image/*',
],
'pluginOptions' => [
'showUpload' => false,
],
]) ?>
<?php if ( isset ( $model -> _post ) && $model -> _post -> image ) : ?>
<? = Html :: img ( $model -> _post -> getThumbFileUrl ( 'image' , 'thumb_gallery_view' ), [
'class' => 'thumbnail',
'width' => 300,
]) ?>
<? = $form -> field ( $model , 'reset_image' ) -> checkbox () ?>
<?php endif ; ?>
< / div >
< div id = "field_video" class = "tab-pane fade" style = "padding-top: 20px;" >
<? = $form -> field ( $model , 'video' ) -> textInput () -> label ( Yii :: t ( 'blog' , 'YouTube URL' )) -> hint ( Yii :: t ( 'blog' , 'If a video link is specified, the image will be used as a preview image' )) ?>
< / div >
< / div >
< / div >
< / div >
< div class = "box box-default" >
< div class = "box-header with-border" > <? = Yii :: t ( 'blog' , 'SEO' ) ?> </ div >
< div class = "box-body" >
<? = $form -> field ( $model -> meta , 'title' ) -> textInput () ?>
<? = $form -> field ( $model -> meta , 'description' ) -> textarea ([ 'rows' => 2 ]) ?>
<? = $form -> field ( $model -> meta , 'keywords' ) -> textInput () ?>
< / div >
< / div >
< div class = "form-group" >
<? = Html :: submitButton ( Yii :: t ( 'buttons' , 'Save' ), [ 'class' => 'btn btn-success' ]) ?>
< / div >
< / div >
< div class = "col-md-2" >
< div class = "box box-default" >
< div class = "box-header with-border" > <? = Yii :: t ( 'blog' , 'Publish' ) ?> </ div >
< div class = "box-body" >
<? = Html :: button ( Yii :: t ( 'blog' , 'Preview on site' )) ?>
< hr >
<? = $form -> field ( $model , 'status' ) -> radioList ( BlogPostHelper :: statusList ()) ?>
< / div >
< / div >
< / div >
< / div >
< div class = "box box-default" >
< div class = "box-header with-border" > <? = Yii :: t ( 'blog' , 'SEO' ) ?> </ div >
< div class = "box-body" >
<? = $form -> field ( $model -> meta , 'title' ) -> textInput () ?>
<? = $form -> field ( $model -> meta , 'description' ) -> textarea ([ 'rows' => 2 ]) ?>
<? = $form -> field ( $model -> meta , 'keywords' ) -> textInput () ?>
< / div >
< / div >
< div class = "form-group" >
<? = Html :: submitButton ( Yii :: t ( 'buttons' , 'Save' ), [ 'class' => 'btn btn-success' ]) ?>
< / div >
<?php ActiveForm :: end (); ?>
< / div >