Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 14th, 2012  |  syntax: None  |  size: 0.84 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Getting XHR pagination working with HAML   Kaminari
  2. :javascript
  3.   $(function() {
  4.     $('#events').html('<%= escape_javascript render(@events) %>');
  5.     $('#paginator').html('<%= escape_javascript(paginate(@events, :remote => true).to_s) %>');
  6.   });
  7.  
  8.     %ul.activity_list
  9.       #events
  10.         = render :partial => 'event'
  11.        
  12. - @events.each do |event|
  13.   = display_event(event)
  14.        
  15. %nav
  16.       %ul.pagination
  17.         #paginator
  18.           = paginate @events, :remote => true
  19.        
  20. :javascript
  21.   $(function() {
  22.     $('#events').html('#{escape_javascript render('event')}');
  23.     $('#paginator').html('#{escape_javascript(paginate(@events, :remote => true).to_s)}');
  24.   });
  25.        
  26. :javascript
  27.   $(function() {
  28.     $('#events').html('#{escape_javascript render(@events)}');
  29.     $('#paginator').html('#{escape_javascript(paginate(@events, :remote => true).to_s)}');
  30.   });