Skip to content

Commit

Permalink
[5.2] Usability: Back-end - Add item position and total count to Page…
Browse files Browse the repository at this point in the history
… Navigation (#43575)

* Add item position and total count to Page Navigation

* Update layouts/joomla/pagination/links.php

* Update language/en-GB/lib_joomla.ini

* Update administrator/language/en-GB/lib_joomla.ini
---------

Co-authored-by: Brian Teeman <[email protected]>
  • Loading branch information
HLeithner and brianteeman authored Jun 3, 2024
1 parent dfb572d commit aa3ab7c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions administrator/language/en-GB/lib_joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ JLIB_HTML_NO_RECORDS_FOUND="No records found."
JLIB_HTML_PAGE_CURRENT="Page %s"
JLIB_HTML_PAGE_CURRENT_OF_TOTAL="Page %s of %s"
JLIB_HTML_PAGINATION="Pagination"
JLIB_HTML_PAGINATION_NUMBERS="%1$d - %2$d / %3$d items"
JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST="Please first make a selection from the list."
JLIB_HTML_PUBLISH_ITEM="Publish Item"
JLIB_HTML_PUBLISHED_EXPIRED_ITEM="Published, but has Expired."
Expand Down
1 change: 1 addition & 0 deletions language/en-GB/lib_joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ JLIB_HTML_NO_RECORDS_FOUND="No records found."
JLIB_HTML_PAGE_CURRENT="Page %s"
JLIB_HTML_PAGE_CURRENT_OF_TOTAL="Page %s of %s"
JLIB_HTML_PAGINATION="Pagination"
JLIB_HTML_PAGINATION_NUMBERS="%1$d - %2$d / %3$d items"
JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST="Please first make a selection from the list."
JLIB_HTML_PUBLISH_ITEM="Publish Item"
JLIB_HTML_PUBLISHED_EXPIRED_ITEM="Published, but has Expired."
Expand Down
28 changes: 19 additions & 9 deletions layouts/joomla/pagination/links.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@

$list = $displayData['list'];
$pages = $list['pages'];
$total = $list['total'];

$options = new Registry($displayData['options']);

$showLimitBox = $options->get('showLimitBox', false);
$showPagesLinks = $options->get('showPagesLinks', true);
$showLimitStart = $options->get('showLimitStart', true);
$showLimitBox = $options->get('showLimitBox', false);
$showPagesLinks = $options->get('showPagesLinks', true);
$showLimitStart = $options->get('showLimitStart', true);
$showItemPosition = $options->get('showItemPosition', true);

// Calculate to display range of pages
$currentPage = 1;
Expand All @@ -43,21 +45,29 @@
$range = ceil($currentPage / $step);
}
}
?>

$first = ($currentPage - 1) * $list['limit'] + 1;
$last = $first + $list['limit'] - 1;
$last = $last > $total ? $total : $last;

<?php if (!empty($pages)) : ?>
?>
<?php if (!empty($pages) || $showItemPosition) : ?>
<nav class="pagination__wrapper" aria-label="<?php echo Text::_('JLIB_HTML_PAGINATION'); ?>">
<div class="pagination pagination-toolbar text-center">
<?php if ($showItemPosition) : ?>
<div class="text-end me-3">
<?php echo Text::sprintf('JLIB_HTML_PAGINATION_NUMBERS', $first, $last, $total); ?>
</div>
<?php endif; ?>

<div class="pagination pagination-toolbar text-center mt-0">

<?php if ($showLimitBox) : ?>
<div class="limit float-end">
<?php echo Text::_('JGLOBAL_DISPLAY_NUM') . $list['limitfield']; ?>
</div>
<?php endif; ?>

<?php if ($showPagesLinks) : ?>
<ul class="pagination ms-auto mb-4 me-0">
<?php if ($showPagesLinks && !empty($pages)) : ?>
<ul class="pagination ms-auto me-0">
<?php echo LayoutHelper::render('joomla.pagination.link', $pages['start']); ?>
<?php echo LayoutHelper::render('joomla.pagination.link', $pages['previous']); ?>
<?php foreach ($pages['pages'] as $k => $page) : ?>
Expand Down

0 comments on commit aa3ab7c

Please sign in to comment.