From 3dc17ed63093d5156527f01baf115d91fdd3d81d Mon Sep 17 00:00:00 2001 From: stes Date: Mon, 11 Sep 2017 11:19:19 +0300 Subject: [PATCH] hidden comment in card --- resources/artbox_comment.css | 3 +++ resources/artbox_comment.js | 13 +++++++++++++ views/artbox_comment_item.php | 4 ++++ views/artbox_comment_list.php | 20 ++++++++++++++++++-- widgets/CommentWidget.php | 13 +++++++++++-- 5 files changed, 49 insertions(+), 4 deletions(-) diff --git a/resources/artbox_comment.css b/resources/artbox_comment.css index 7ca9879..8b08853 100755 --- a/resources/artbox_comment.css +++ b/resources/artbox_comment.css @@ -316,4 +316,7 @@ .comments-start ul.pagination li.active a { color: #333; background-color: inherit; +} +.artbox-comment-list .show_more_block{ + } \ No newline at end of file diff --git a/resources/artbox_comment.js b/resources/artbox_comment.js index d54fc60..ada2d2a 100755 --- a/resources/artbox_comment.js +++ b/resources/artbox_comment.js @@ -321,4 +321,17 @@ form.trigger('reset'); } + + })(window.jQuery); + +$(document).on('click', '#show_more_link', function(){ + $("#show_more").show(); + $("#show_more_link").hide(); +}); + +$(document).on('click', '#hide_more_link', function(){ + $("#show_more").hide(); + $("#show_more_link").show(); +}); + diff --git a/views/artbox_comment_item.php b/views/artbox_comment_item.php index 6630afd..c5f4604 100755 --- a/views/artbox_comment_item.php +++ b/views/artbox_comment_item.php @@ -10,8 +10,11 @@ * @var int $index * @var ListView $widget * @var string $display_name + * @var array $more */ + ?> +
@@ -166,3 +169,4 @@ ?>
+ diff --git a/views/artbox_comment_list.php b/views/artbox_comment_list.php index f1afc9c..eae869d 100755 --- a/views/artbox_comment_list.php +++ b/views/artbox_comment_list.php @@ -32,8 +32,24 @@ 'viewParams' => [ 'display_name' => $display_name, 'reply' => $reply, - 'delete' => $delete - ] + 'delete' => $delete, + 'more' => $more, + 'last' => $comments->count, + ], + 'beforeItem' => function ($model, $key, $index, $widget) use ($more, $comments) { + if ($more['key'] == $index and $more['show_'] ){ + + return "Показать еще + "; + } +} + ]); Pjax::end(); diff --git a/widgets/CommentWidget.php b/widgets/CommentWidget.php index ec939d2..7bf0083 100755 --- a/widgets/CommentWidget.php +++ b/widgets/CommentWidget.php @@ -153,7 +153,14 @@ * @var string entity id attribute */ public $entityIdAttribute; - + + /** + * show more + */ + public $more = [ + "show_" => false, + 'key' => -1, + ]; /** * Info to be passed to Comment Model * @@ -415,7 +422,9 @@ 'item_view' => $this->itemView, 'display_name' => $this->display_name, 'reply' => $this->reply, - 'delete' => $this->delete + 'delete' => $this->delete, + 'more' => $this->more, + ] ), -- libgit2 0.21.4