Paginationwith lightbox gone wild and will paginate

Fri Jan 22 23:41:54 2010

In order to get will_paginate to work with lightbox gone wild, I had to make the following modifications:

Step 1

First we need to modify the lightbox.js file. Similar to the example below create a block for next, prev, and start functions.

next: function(e){
link = Event.element(e);
var myAjax = new Ajax.Request( link.href, {method: 'post', parameters: "", onComplete: this.processInfo.bindAsEventListener(this)} );

Step 2

Create a new global helper method inside application_helper.rb file. This method will the object that needs to be paginated along with the params and create modified links.
Here we are using Hpricot gem to parse through the links created by will_paginate method and add classes and rel for lightbox to work.

Step 3

Call will_paginate_modified from your lightbox gone wild pop up view file.

will_paginate_modified @my_collection, params