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