#91 ✓resolved
Andy Stewart

Optional Previous and Next links

Reported by Andy Stewart | August 24th, 2007 @ 12:18 PM

The view helper always generates previous and next links. I would prefer to have a choice about whether they are generated or not.

This patch gives you that choice. By setting the :prev_label and :next_label view helper options to '' the links are not generated:

WillPaginate::ViewHelpers.pagination_options[:prev_label] = ''

WillPaginate::ViewHelpers.pagination_options[:next_label] = ''

I've attached a diff.

I couldn't see any tests for the view helper so I haven't added any ;)

Comments and changes to this ticket

  • Elijah Miller

    Elijah Miller August 24th, 2007 @ 01:04 PM

    I was just to about to do the same thing! It would preferable if it could accept nil too.

  • Andy Stewart

    Andy Stewart August 24th, 2007 @ 01:15 PM

    You can set those options to nil or '' and either way the previous

    and next links will be suppressed.

    This works because I use #blank? on the options to decide what to do.

    Is this what you meant?

  • Elijah Miller

    Elijah Miller August 24th, 2007 @ 01:20 PM

    Yes exactly what I meant! Good work.

    I wish everyone could see the attachments!

  • Chris Wanstrath

    Chris Wanstrath August 24th, 2007 @ 06:11 PM

    • Assigned user changed from “Chris Wanstrath” to “Mislav”
    • State changed from “new” to “open”
  • Mislav

    Mislav December 25th, 2007 @ 02:41 AM

    • State changed from “open” to “resolved”

    Thanks for the suggestion, but I'm determined to keep prev/next links because they are the most important element to pagination. I will never make an option to turn them off.

    With recent changes to the plugin, it's easier to roll your own pagination HTML, anyway.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Everyone's favorite Ruby library for pagination of practically anything!

People watching this ticket