Blame view

frontend/views/comment/artbox_comment_list.php 2.1 KB
518c4e3f   Alexey Boroda   -Article with com...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  <?php
      use artbox\webcomment\models\CommentModel;
      use yii\base\Model;
      use yii\data\ActiveDataProvider;
      use yii\helpers\Html;
      use yii\web\View;
      use yii\widgets\ListView;
      use yii\widgets\Pjax;
      
      /**
       * @var CommentModel       $comment_model
       * @var array              $list_params
       * @var array              $item_options
       * @var string             $item_view
       * @var Model              $model
       * @var ActiveDataProvider $comments
       * @var View               $this
       * @var string             $display_name
       * @var boolean            $reply ,
       * @var boolean            $delete
       */
      Pjax::begin();
      if(( $success = \Yii::$app->session->getFlash('artbox_comment_success') ) != NULL) {
          echo Html::tag('p', $success);
      }
505c1c76   Eugeny Galkovskiy   Блог
26
27
  echo '<div class="comments-border"></div>';
  echo '<h4 class="text-uppercase">Комментарии</h4>';
518c4e3f   Alexey Boroda   -Article with com...
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
      echo ListView::widget([
          'dataProvider' => $comments,
          'itemOptions'  => $item_options,
          'itemView'     => $item_view,
          'emptyText'    => false,
          'summary'      => '',
          'viewParams'   => [
              'display_name'  => $display_name,
              'reply'         => $reply,
              'delete'        => $delete,
              'more'          => $more,
              'last'          => $comments->count,
          ],
          'beforeItem' => function ($model, $key, $index, $widget) use ($more, $comments) {
                  if ($more['key'] == $index and $more['show_'] ){
                      
                      return "<a id='show_more_link' style='cursor:pointer'>Показать еще</a>
                                  <div id='show_more' style='display: none'>";
                  }
          },
          'afterItem' => function ($model, $key, $index, $widget) use ($more, $comments) {
              if ($index == ($comments->count-1) and $more['show_'] and $more['key'] < $comments->count){
                  
                  return "<a id='hide_more_link' style='cursor:pointer'>Скрыть комментарии</a></div>";
              }
505c1c76   Eugeny Galkovskiy   Блог
53
          }
518c4e3f   Alexey Boroda   -Article with com...
54
55
56
57
58
      
          
      ]);
      Pjax::end();