|
|
|
<?php
|
|
|
|
|
|
|
|
use common\modules\blog\helpers\BlogPostHelper;
|
|
|
|
use yii\helpers\ArrayHelper;
|
|
|
|
use yii\helpers\Html;
|
|
|
|
use yii\widgets\DetailView;
|
|
|
|
|
|
|
|
/* @var $this yii\web\View */
|
|
|
|
/* @var $post \common\modules\blog\entities\BlogPost */
|
|
|
|
/* @var $modificationsProvider yii\data\ActiveDataProvider */
|
|
|
|
|
|
|
|
$title = $post->title;
|
|
|
|
$this->title = $title;
|
|
|
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('blog', 'Posts'), 'url' => ['index']];
|
|
|
|
$this->params['breadcrumbs'][] = $title;
|
|
|
|
?>
|
|
|
|
<div class="post-view">
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<?= Html::a(Yii::t('blog', 'All Posts'), ['index'], ['class' => 'btn btn-default']) ?>
|
|
|
|
<?php if ($post->isActive()): ?>
|
|
|
|
<?= Html::a(Yii::t('blog', 'Draft'), ['draft', 'id' => $post->id], ['class' => 'btn btn-primary', 'data-method' => 'post']) ?>
|
|
|
|
<?php else: ?>
|
|
|
|
<?= Html::a(Yii::t('blog', 'Activate'), ['activate', 'id' => $post->id], ['class' => 'btn btn-success', 'data-method' => 'post']) ?>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?= Html::a(Yii::t('buttons', 'Edit'), ['update', 'id' => $post->id], ['class' => 'btn btn-primary']) ?>
|
|
|
|
<?= Html::a(Yii::t('buttons', 'Delete'), ['delete', 'id' => $post->id], [
|
|
|
|
'class' => 'btn btn-danger',
|
|
|
|
'data' => [
|
|
|
|
'confirm' => Yii::t('buttons', 'Are you sure you want to delete this item?'),
|
|
|
|
'method' => 'post',
|
|
|
|
],
|
|
|
|
]) ?>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div class="box">
|
|
|
|
<div class="box-header with-border"><?= Yii::t('blog', 'Common') ?></div>
|
|
|
|
<div class="box-body">
|
|
|
|
<?= DetailView::widget([
|
|
|
|
'model' => $post,
|
|
|
|
'attributes' => [
|
|
|
|
'id',
|
|
|
|
[
|
|
|
|
'attribute' => 'status',
|
|
|
|
'value' => BlogPostHelper::statusLabel($post->status),
|
|
|
|
'format' => 'raw',
|
|
|
|
],
|
|
|
|
'title',
|
|
|
|
[
|
|
|
|
'attribute' => 'category_id',
|
|
|
|
'value' => ArrayHelper::getValue($post, 'category.name'),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'label' => Yii::t('post', 'Tags'),
|
|
|
|
'format' => 'raw',
|
|
|
|
'value' => '<i class="fa fa-tag" aria-hidden="true"></i> ' . implode(' <i class="fa fa-tag" aria-hidden="true"></i> ', ArrayHelper::getColumn($post->tags, 'name')),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
]) ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php if ($post->image): ?>
|
|
|
|
<div class="box">
|
|
|
|
<div class="box-header with-border"><?= Yii::t('blog', 'Image') ?></div>
|
|
|
|
<div class="box-body">
|
|
|
|
<?= Html::img($post->getThumbFileUrl('image', 'thumb_gallery_view'), [
|
|
|
|
'class' => 'thumbnail',
|
|
|
|
'width' => 300,
|
|
|
|
]) ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<?php if (!$post->image && $post->video): ?>
|
|
|
|
<div class="box">
|
|
|
|
<div class="box-header with-border"><?= Yii::t('blog', 'Image') ?></div>
|
|
|
|
<div class="box-body">
|
|
|
|
<?= Html::img('https://i.ytimg.com/vi/' . BlogPostHelper::parseYoutubeUrl($post->video) . '/maxresdefault.jpg', [
|
|
|
|
'width' => 300,
|
|
|
|
'class' => 'thumbnail',
|
|
|
|
]) ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<?php if ($post->video): ?>
|
|
|
|
<div class="box">
|
|
|
|
<div class="box-header with-border"><?= Yii::t('blog', 'Video') ?></div>
|
|
|
|
<div class="box-body">
|
|
|
|
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/<?= BlogPostHelper::parseYoutubeUrl($post->video) ?>?rel=0" frameborder="0" allowfullscreen></iframe>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<div class="box">
|
|
|
|
<div class="box-header with-border"><?= Yii::t('blog', 'Description') ?></div>
|
|
|
|
<div class="box-body">
|
|
|
|
<?= Yii::$app->formatter->asNtext($post->description) ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="box">
|
|
|
|
<div class="box-header with-border"><?= Yii::t('blog', 'Content') ?></div>
|
|
|
|
<div class="box-body">
|
|
|
|
<?= Yii::$app->formatter->asHtml($post->content, [
|
|
|
|
'Attr.AllowedRel' => array('nofollow'),
|
|
|
|
'HTML.SafeObject' => true,
|
|
|
|
'Output.FlashCompat' => true,
|
|
|
|
'HTML.SafeIframe' => true,
|
|
|
|
'URI.SafeIframeRegexp'=>'%^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/)%',
|
|
|
|
]) ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="box">
|
|
|
|
<div class="box-header with-border"><?= Yii::t('blog', 'SEO') ?></div>
|
|
|
|
<div class="box-body">
|
|
|
|
<?= DetailView::widget([
|
|
|
|
'model' => $post,
|
|
|
|
'attributes' => [
|
|
|
|
[
|
|
|
|
'attribute' => 'meta.title',
|
|
|
|
'value' => $post->meta->title,
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'attribute' => 'meta.description',
|
|
|
|
'value' => $post->meta->description,
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'attribute' => 'meta.keywords',
|
|
|
|
'value' => $post->meta->keywords,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
]) ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|