Skip to content

Commit

Permalink
Merge pull request #157 from leemyongpakvn/stop-using-jquerySimplePag…
Browse files Browse the repository at this point in the history
…ination

Stop using jquery simple pagination
  • Loading branch information
kpodemski authored Mar 31, 2023
2 parents 184f874 + aeb3768 commit de5160c
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 430 deletions.
9 changes: 8 additions & 1 deletion productcomments.php
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,6 @@ public function hookDisplayHeader()
if ($this->context->controller instanceof ProductControllerCore) {
$jsList[] = '/modules/productcomments/views/js/post-comment.js';
$jsList[] = '/modules/productcomments/views/js/list-comments.js';
$jsList[] = '/modules/productcomments/views/js/jquery.simplePagination.js';
}
foreach ($cssList as $cssUrl) {
$this->context->controller->registerStylesheet(sha1($cssUrl), $cssUrl, ['media' => 'all', 'priority' => 80]);
Expand Down Expand Up @@ -969,6 +968,13 @@ private function renderProductCommentsList($product)
$commentsNb = $productCommentRepository->getCommentsNumber($product->id, (bool) Configuration::get('PRODUCT_COMMENTS_MODERATE'));
$isPostAllowed = $productCommentRepository->isPostAllowed($product->id, (int) $this->context->cookie->id_customer, (int) $this->context->cookie->id_guest);

/* configure pagination */
$commentsTotalPages = 0;
$commentsPerPage = (int) Configuration::get('PRODUCT_COMMENTS_COMMENTS_PER_PAGE');
if ($commentsNb > 0) {
$commentsTotalPages = ceil($commentsNb / $commentsPerPage);
}

$this->context->smarty->assign([
'post_allowed' => $isPostAllowed,
'usefulness_enabled' => Configuration::get('PRODUCT_COMMENTS_USEFULNESS'),
Expand All @@ -987,6 +993,7 @@ private function renderProductCommentsList($product)
'productcomments',
'ReportComment'
),
'list_total_pages' => $commentsTotalPages,
]);

return $this->context->smarty->fetch('module:productcomments/views/templates/hook/product-comments-list.tpl');
Expand Down
10 changes: 7 additions & 3 deletions views/css/productcomments.css
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@
font-size: 13px;
}

@media (min-width: 768px) {
@media (min-width: 960px) {
#product-comments-list-footer {
position: relative;
min-height: 45px;
Expand All @@ -607,7 +607,7 @@
}
}

@media (max-width: 768px) {
@media (max-width: 960px) {
#product-comments-list-footer {
display: flex;
flex-direction: row-reverse;
Expand All @@ -616,7 +616,7 @@
}
}

@media (max-width: 576px) {
@media (max-width: 768px) {
#product-comments-list-footer {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -665,3 +665,7 @@
#product-comments-list-pagination ul li.active span {
cursor: not-allowed;
}

#product-comments-list-pagination ul li.hidden {
display: none;
}
Loading

0 comments on commit de5160c

Please sign in to comment.