Hello

I've found some strange style in pager links.
Looking at pager.inc, I notice that pager_first is also used by pager_previous.
Then we call pager_first in pager_previous, the style must be adapted.

Same thing for the couple pager-last / pager-next.

drupal 4.7.2 2006/06/01
jj cambefort

Comments

chx’s picture

Please provide a patch per http://drupal.org/diffandpatch

magico’s picture

Version: 4.7.2 » 5.x-dev

I do not know if this is really a bug. Let's assume a list of items that creates 3 pages, and we are in page 2 (it works as expected if we go to page 3).

The css class tree for the pager is:
- pager
- "pager-first active" (Go to first page)
- "pager-first active" (Go to previous page)
- "pager-list"
- "pager-first active" (Go to page 1)"
- "pager-current"

So there is a bug, that duplicates the CSS for two different things, disallowing the correct styling for "first", "previous". Check also "next" and "last" because the same problem happens.

Stefan Nagtegaal’s picture

Priority: Normal » Critical

This is buggy behaviour in one of the theme_pager() or theme_pager_*() functions..
Priority critical.. I'll see if I have some time to backtrace where this is coming from today, or if someone else is willing todo it..
Feel free...

ChrisKennedy’s picture

Priority: Critical » Normal

This would be good to fix but it doesn't break anything (http://drupal.org/node/45111 has priority guidelines) and should not block a release.

Nick Robillard’s picture

After some thought, I would call this a bug too.

Here's what i notice happening. When i'm on page 2, the "previous" & "first" links will have the same class because both take you to the SAME page. Same for when one is at the second to last page - the "next" and "last" links lead to the SAME page.

The logic is kind of twisted - the applied classes are based on where the link TAKES you, rather than what the link actually is. As far as I'm concerned, the "next" pager link, is ALWAYS a "next" link, no matter where it TAKES you. It should never be given the class "last", even if it technically takes me to the last page.

From a theming standpoint, it makes things quite difficult. At very least, there needs to be something unique between the 2 links. The theming aspect was definitely overlooked.

Nick Robillard’s picture

Status: Active » Needs review
StatusFileSize
new1.57 KB
new2.12 KB

Here is my fix. There are 2 ways to apply it:

1) A patch.
2) A snippet to be included in template.php.

What this fix does
Removes the checks in "theme_pager_previous" and "theme_pager_next" for links that point to 1st or last page. Now "previous" and "next" links never get the classes "pager-first" or "pager-last".

Because the original dev intentionally made the pager behave like it did, I hesitate to call this a bug fix. Either way, this issue is now resolved. I've tested both methods on my installation.

EDIT: Oops - should have named the patch file "pager-69345-1152871.patch". (can't edit the attached files)

drumm’s picture

Version: 5.x-dev » 7.x-dev
Status: Needs review » Needs work

This should not change in stable versions of Drupal. Themes are likely to rely on the current behavior. This might be changed the the development version of Drupal.

jody lynn’s picture

Version: 7.x-dev » 8.x-dev
jhedstrom’s picture

Issue summary: View changes
Status: Needs work » Closed (duplicate)

I think the pager finally got a bit of cleanup work in the D8 cycle. See #1598886: Clean up pager theme functions and twig template conversion issues.