Skip to content

Commit

Permalink
#3064 Paginate improvements + Groups app usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
romanlesnikov committed Sep 23, 2021
1 parent e889c57 commit beb98d0
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 3 deletions.
5 changes: 5 additions & 0 deletions inc/js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ function loadDynamicBlockAutoPaginate (e, iStart, iPerPage, sAdditionalUrlParams
if ('undefined' != typeof(sAdditionalUrlParams))
sUrl = bx_append_url_params(sUrl, sAdditionalUrlParams);

if ($(e).parents('.bx-search-result-block-pagination').length > 0){
$([document.documentElement, document.body]).animate({
scrollTop: $(e).parents('.bx-search-result-block-pagination').first().offset().top
}, 500);
}
return loadDynamicBlockAuto(e, sUrl);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function showPagination($bAdmin = false, $bChangePage = true, $bPageReload = tru
if(empty($sPagination))
return '';

return '<div class="bx-search-result-block-pagination bx-def-margin-top">' . $sPagination . '</div>';
return $sPagination;
}

protected function getItemPerPageInShowCase ()
Expand Down
2 changes: 1 addition & 1 deletion modules/boonex/groups/classes/BxGroupsSearchResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function __construct($sMode = '', $aParams = false)
'joinFields' => array(),
),
),
'paginate' => array('perPage' => getParam('bx_groups_per_page_browse'), 'start' => 0),
'paginate' => array('perPage' => getParam('bx_groups_per_page_browse'), 'start' => 0, 'on_top' => true, 'on_bottom' => true),
'sorting' => 'last',
'rss' => array(
'title' => '',
Expand Down
13 changes: 13 additions & 0 deletions template/paginate_block.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div class="bx-search-result-block-pagination">
<bx_if:top>
<div class="bx-def-margin-bottom">
__paginate__
</div>
</bx_if:top>
__content__
<bx_if:bottom>
<div class="bx-def-margin-top">
__paginate__
</div>
</bx_if:bottom>
</div>
17 changes: 16 additions & 1 deletion template/scripts/BxBaseSearchResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,22 @@ function displayResultBlock ()

function displaySearchBox ($sContent, $sPaginate = '')
{
$sContent .= $sPaginate;
$sContent = BxDolTemplate::getInstance()->parseHtmlByName('paginate_block.html', array(
'bx_if:top' => array(
'condition' => isset($this->aCurrent['paginate']['on_top']) && $this->aCurrent['paginate']['on_top'] == true,
'content' => array(
'paginate' => $sPaginate
),
),
'bx_if:bottom' => array(
'condition' => !isset($this->aCurrent['paginate']['on_bottom']) || $this->aCurrent['paginate']['on_bottom'] != false,
'content' => array(
'paginate' => $sPaginate
),
),
'content' => $sContent
));

$sMenu = $this->getDesignBoxMenu();

if ($this->id) {
Expand Down

0 comments on commit beb98d0

Please sign in to comment.