Skip to content

Commit

Permalink
Isis Pagination update (#18357)
Browse files Browse the repository at this point in the history
* go to page and current page
aria-label start, previous etc
aria-hidden=true
add nav

* codestyle

* codestyle

* fix aria-current

* Add semicolon (#66)

Thanks @Quy
  • Loading branch information
brianteeman authored and Michael Babker committed Oct 26, 2017
1 parent e0e8c95 commit be10e5c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,39 @@
// Check for "Start" item
case JText::_('JLIB_HTML_START') :
$icon = 'icon-backward icon-first';
$aria = JText::sprintf('JLIB_HTML_GOTO_POSITION', strtolower($item->text));
break;

// Check for "Prev" item
case JText::_('JPREV') :
$item->text = JText::_('JPREVIOUS');
$icon = 'icon-step-backward icon-previous';
$aria = JText::sprintf('JLIB_HTML_GOTO_POSITION', strtolower($item->text));
break;

// Check for "Next" item
case JText::_('JNEXT') :
$icon = 'icon-step-forward icon-next';
$aria = JText::sprintf('JLIB_HTML_GOTO_POSITION', strtolower($item->text));
break;

// Check for "End" item
case JText::_('JLIB_HTML_END') :
$icon = 'icon-forward icon-last';
$aria = JText::sprintf('JLIB_HTML_GOTO_POSITION', strtolower($item->text));
break;

default:
$icon = null;
$aria = JText::sprintf('JLIB_HTML_GOTO_PAGE', $item->text);
break;
}

$item->text .= $addText ?: '';

if ($icon !== null)
{
$display = '<span class="' . $icon . '"></span>';
$display = '<span class="' . $icon . '" aria-hidden="true"></span>';
}

if ($displayData['active'])
Expand Down Expand Up @@ -95,12 +100,14 @@
?>
<?php if ($displayData['active']) : ?>
<li<?php echo $liClass ? ' class="' . $liClass . '"' : ''; ?>>
<a <?php echo $cssClasses ? 'class="' . implode(' ', $cssClasses) . '"' : ''; ?> <?php echo $title; ?> href="#" onclick="<?php echo $onClick; ?>">
<a aria-label="<?php echo $aria; ?>" <?php echo $cssClasses ? 'class="' . implode(' ', $cssClasses) . '"' : ''; ?> <?php echo $title; ?> href="#" onclick="<?php echo $onClick; ?>">
<?php echo $display; ?>
</a>
</li>
<?php else : ?>
<li class="<?php echo $class; ?>">
<span><?php echo $display; ?></span>
<span <?php echo $class == 'active' ? 'aria-current="true" aria-label="' . JText::sprintf('JLIB_HTML_PAGE_CURRENT', $item->text) . '"' : ''; ?>>
<?php echo $display; ?>
</span>
</li>
<?php endif;
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,23 @@
<?php endif; ?>

<?php if ($showPagesLinks && (!empty($pages))) : ?>
<ul class="pagination-list">
<?php
$pages['start']['pagOptions'] = array('addText' => ' (' . JText::sprintf('JLIB_HTML_PAGE_CURRENT_OF_TOTAL', 1, $pagesTotal) . ')');
echo JLayoutHelper::render('joomla.pagination.link', $pages['start']);
echo JLayoutHelper::render('joomla.pagination.link', $pages['previous']); ?>
<?php foreach ($pages['pages'] as $page) :
$page['pagOptions'] = array('liClass' => 'hidden-phone');
?>
<?php echo JLayoutHelper::render('joomla.pagination.link', $page); ?>
<?php endforeach; ?>
<?php
echo JLayoutHelper::render('joomla.pagination.link', $pages['next']);
$pages['end']['pagOptions'] = array('addText' => ' (' . JText::sprintf('JLIB_HTML_PAGE_CURRENT_OF_TOTAL', $pagesTotal, $pagesTotal) . ')');
echo JLayoutHelper::render('joomla.pagination.link', $pages['end']); ?>
</ul>
<nav role="navigation" aria-label="<?php echo JText::_('JLIB_HTML_PAGINATION'); ?>">
<ul class="pagination-list">
<?php
$pages['start']['pagOptions'] = array('addText' => ' (' . JText::sprintf('JLIB_HTML_PAGE_CURRENT_OF_TOTAL', 1, $pagesTotal) . ')');
echo JLayoutHelper::render('joomla.pagination.link', $pages['start']);
echo JLayoutHelper::render('joomla.pagination.link', $pages['previous']); ?>
<?php foreach ($pages['pages'] as $page) :
$page['pagOptions'] = array('liClass' => 'hidden-phone');
?>
<?php echo JLayoutHelper::render('joomla.pagination.link', $page); ?>
<?php endforeach; ?>
<?php
echo JLayoutHelper::render('joomla.pagination.link', $pages['next']);
$pages['end']['pagOptions'] = array('addText' => ' (' . JText::sprintf('JLIB_HTML_PAGE_CURRENT_OF_TOTAL', $pagesTotal, $pagesTotal) . ')');
echo JLayoutHelper::render('joomla.pagination.link', $pages['end']); ?>
</ul>
</nav>
<?php endif; ?>

<?php if ($showLimitStart) : ?>
Expand Down

0 comments on commit be10e5c

Please sign in to comment.