Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.2] Usability: Back-end - Add item position and total count to Page Navigation #43575

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) : ?>
chmst marked this conversation as resolved.
Show resolved Hide resolved
<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