<?php
    
    use artbox\core\helpers\ImageHelper;
    use yii\bootstrap\Html;
    use artbox\core\helpers\Url;
    use artbox\core\services\Languages;
    use yii\helpers\VarDumper as d;
    /**
     * @var \common\models\blog\Article $model
     */

?>

<section class="post">
  <div class="row">
    <div class="col-xs-4 col-sm-4 col-md-4">
      <div class="image">
        <a href="<?= Url::to(
            [
               'alias' => $model->alias
            ]
        ) ?>">
            <?= ImageHelper::set($model->image ? $model->image->getPath() : '@frontend/web/img/no-image.png')
                           ->cropResize(263, 197)
                           ->renderImage(
                               [
                                   'class' => 'img-responsive',
                                   'alt'   => $model->title,
                               ]
                           ) ?>
        </a>
      </div>
    </div>
    <div class="col-xs-8 col-sm-8 col-md-8">
      <h2><a href="<?= Url::to(
              [
                'alias' => $model->alias
              ]
          ) ?>"><?= $model->title; ?></a></h2>
      <div class="clearfix">
          <?php if (empty($model->categories)) { ?>
              <p class="author-category"></p>
          <?php } else {
              $i = 0;
              foreach ($model->categories as $category) {
                  $i++;
                  ?>
                <p class="author-category">
                  <a href="<?=Url::to(['alias' => $category->alias])?>"><?=$category->title?></a>
                    <?php
                       
                        if ($i === count($model->categories)) {
                            echo '&#160';
                        } else {
                            echo '&#44&#160';
                        }
                    ?></p>
                  <?php
              }
          } ?>
        <p class="date-comments">

            <!--            <i class="fa fa-calendar-o"></i> --><?php //#echo\Yii::$app->formatter->asDate($model->created_at, 'short'); ?>
          <!--          <a href="blog-post.html"><i class="fa fa-comment-o"></i> 8 комментариев</a>-->
        </p>
      </div>
      <p class="intro"><?= $model->body_preview; ?></p>
      <p class="read-more">
          <?= Html::a(
              \Yii::t('app', 'Continue reading'),
              [
                  '', 'alias' => $model->alias
              ],
              [
                  'class' => 'btn btn-template-main',
              ]
          ) ?>
      </p>
    </div>
  </div>
</section>
