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 #3197

Closed
jgerman-bot opened this issue Jun 4, 2024 · 0 comments · Fixed by #3198
Closed

Comments

@jgerman-bot
Copy link

New language relevant PR in upstream repo: joomla/joomla-cms#43575 Here are the upstream changes:

Click to expand the diff!
diff --git a/administrator/language/en-GB/lib_joomla.ini b/administrator/language/en-GB/lib_joomla.ini
index 637d26c4feafe..695d505929b33 100644
--- a/administrator/language/en-GB/lib_joomla.ini
+++ b/administrator/language/en-GB/lib_joomla.ini
@@ -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."
diff --git a/language/en-GB/lib_joomla.ini b/language/en-GB/lib_joomla.ini
index c26137e7ff318..99afcc73211ff 100644
--- a/language/en-GB/lib_joomla.ini
+++ b/language/en-GB/lib_joomla.ini
@@ -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."
diff --git a/layouts/joomla/pagination/links.php b/layouts/joomla/pagination/links.php
index 82747a4c87e1d..e103fb3c10c4b 100644
--- a/layouts/joomla/pagination/links.php
+++ b/layouts/joomla/pagination/links.php
@@ -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;
@@ -43,12 +45,20 @@
         $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">
@@ -56,8 +66,8 @@
                 </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) : ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment