Skip to content

Instantly share code, notes, and snippets.

@pelcasandra
Created February 3, 2011 11:30
Show Gist options
  • Save pelcasandra/809375 to your computer and use it in GitHub Desktop.
Save pelcasandra/809375 to your computer and use it in GitHub Desktop.
# In updates.html.erb
<%= render @attachments %>
<%= will_paginate(@attachments) %>
<%= pageless(@attachments.total_pages, attachments_path) %>
# In application_helper.rb
def pageless(total_pages, url=nil, container=nil)
opts = {
:totalPages => total_pages,
:url => url,
:loaderMsg => 'Loading more results'
}
container && opts[:container] ||= container
javascript_tag("$('#results').pageless(#{opts.to_json});")
end
# Layout in application.html.erb
<div id="wrapper">
<div id="container" class="container">
<div id="results">
<%= yield -%>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment