Download & Extend

Include first/last links by default, and dev version working better than official release

Project:Custom Pagers
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Since some of us use Custom Pagers for webcomics, would it be possible to include the first and last link code, even if it is commented out by default? (Also, can the changes in the dev version be rolled into the official release?)

Here is what I've done:
In custom_pagers.module I replaced

  $vars['previous'] = !empty($nav['prev']) ? l('‹ ' . t('previous'), 'node/'. $nav['prev']) : '';
  $vars['key'] = t('@count of @count_total', array('@count' => ($nav['current_index'] + 1), '@count_total' => count($nav['full_list'])));
  $vars['next'] =  !empty($nav['next']) ? l(t('next') . ' ›', 'node/'. $nav['next']) : '';

with

  $vars['first'] = ($nav['first']) ? l(t('‹‹ first'), 'node/'. $nav['first']) : '';
  $vars['previous'] = !empty($nav['prev']) ? l('‹ ' . t('previous'), 'node/'. $nav['prev']) : '';
  $vars['key'] = t('@count of @count_total', array('@count' => ($nav['current_index'] + 1), '@count_total' => count($nav['full_list'])));
  $vars['next'] =  !empty($nav['next']) ? l(t('next') . ' ›', 'node/'. $nav['next']) : '';
  $vars['last'] = ($nav['last']) ? l(t('latest ››'), 'node/'. $nav['last']) : '';

In custom_pager.tpl.php I replaced

<ul class="custom-pager custom-pager-<?php print $position; ?>">
<li class="previous"><?php print $previous; ?></li>
<li class="key"><?php print $key; ?></li>
<li class="next"><?php print $next; ?></li>
</ul>

with

<ul class="custom-pager custom-pager-<?php print $position; ?>">
<li class="first"><?php print $first; ?></li>
<li class="previous"><?php print $previous; ?></li>
<li class="key"><?php print $key; ?></li>
<li class="next"><?php print $next; ?></li>
<li class="last"><?php print $last; ?></li>
</ul>

Lastly, in custom_pagers.css, I'm using this CSS, which seems to pretty things up a bit when using first and last links:

ul.custom-pager {
  margin: 0;
  padding: 0;
  text-align: center;
}

ul.custom-pager li {
  margin: 0;
  padding-left: 10px;
  padding-right: 10px;
  display: inline;
  list-style-type: none;
  list-style-image: none;
  background: none;
  white-space: nowrap;
}

Comments

#1

Version:6.x-1.10-beta1» 6.x-1.x-dev

Nice quick tweak,
Its now line 287 of custom_pagers.module dev

Would be nice to have an on/off checkbox for this in the module.
cheers

#2

Good idea. If you supply a git patch, you'll have better odds of getting a review.

Hmm... Would it be easier to display the images in a View with Items to display set to 1?