#11 ✓resolved

per_page_links not working

Reported by Silex | October 17th, 2008 @ 12:17 PM

lib/searchgasm/helpers/control_types/link.rb has a little mistake, it uses Config.per_page.text instead of Config.per_page_text (. instead of _).

Change line 279 in add_per_page_link_defaults! to

options[:show_all_text] : Config.per_page_text % per_page

Comments and changes to this ticket

  • Silex

    Silex October 17th, 2008 @ 12:18 PM

    Btw, the current code produces this :

    undefined method text' for 25:Fixnum

  • Silex

    Silex October 17th, 2008 @ 12:19 PM

    Whoopsy, I meant change line 279 to:

    options[:text] ||= per_page.blank? ? options[:show_all_text] : Config.per_page.text % per_page

  • Silex

    Silex October 17th, 2008 @ 12:19 PM

    AAAAARGH, with a _ instead of . :

            options[:text] ||= per_page.blank? ? options[:show_all_text] : Config.per_page_text % per_page
  • Silex

    Silex October 17th, 2008 @ 12:33 PM

    Aaaactually it's wrong again because it doens't handle the :text option properly. Here is the final fix:

          def add_per_page_link_defaults!(per_page, options = {})
            add_searchgasm_control_defaults!(:per_page, options)
            options[:show_all_text] ||= Config.per_page_show_all_text
            options[:text] ||= per_page.blank? ? options[:show_all_text] : Config.per_page_text
            options[:text] %= per_page
            options[:url] = searchgasm_params(options.merge(:search_params => {:per_page => per_page}))
  • Ben Johnson

    Ben Johnson October 20th, 2008 @ 12:34 PM

    • State changed from “new” to “open”

    Thanks for letting me know about this. I will have this fixed today.

  • Ben Johnson

    Ben Johnson October 20th, 2008 @ 10:08 PM

    • State changed from “open” to “resolved”

    This is fixed, let me know if you have any probs. I also added in a class called "ordering_by" if the link is how many items are per page.

  • Ben Johnson

    Ben Johnson October 28th, 2008 @ 02:05 AM

    • Assigned user set to “Ben Johnson”
  • Pak24tv

    Pak24tv December 9th, 2020 @ 01:22 AM

    I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept. Thank you for the post. telenor daily call packages telenor weekly sms packages

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 ยป

Provides common named scopes and object based searching.

People watching this ticket