Created
April 3, 2012 03:29
-
-
Save richardsondx/2289078 to your computer and use it in GitHub Desktop.
Pagination with ajax+kaminari won't paginate @microposts block
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'kaminari' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% for micropost in @microposts %> | |
<span class="article"> | |
<ul> | |
<li class="headshot"><%= image_tag("#{ micropost.to_guys ? "guys" : "girl" }-head.png") %></li> | |
<li class="tipscontent"><p><%= link_to micropost.content, page_path(micropost) %></p></li> | |
<li class="fbshare"> | |
<a href="https://twitter.com/share" class="twitter-share-button" data-via="twitterapi" data-lang="en" data-hashtags="hmdy">Tweet</a> | |
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> | |
</li> | |
</ul> | |
</span> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- BEGINNING of CONTAINER here--> | |
<div id="container"> | |
<div id="separator"><p>What People Are Saying</p></div> | |
<div id="section"> | |
<tbody id="thepost"> | |
<%= render "post" %> | |
</tbody> | |
<div id="paginkamari" align="center"><p><%= paginate @microposts, :remote => :true %></p></div> | |
</div> | |
<div id="footer"> | |
<p>About Advertising Contact us</p> | |
</div> | |
</div> | |
<!-- END of CONTAINER here--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#thepost').html('<%= escape_javascript render("post") %>'); | |
$('#paginkamari').html('<%= escape_javascript(paginate(@microposts, :remote => true).to_s) %>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% for micropost in @microposts %> | |
<span class="article"> | |
<ul> | |
<li class="headshot"><%= image_tag("#{ micropost.to_guys ? "guys" : "girl" }-head.png") %></li> | |
<li class="tipscontent"><p><%= link_to micropost.content, page_path(micropost) %></p></li> | |
<li class="fbshare"> | |
<a href="https://twitter.com/share" class="twitter-share-button" data-via="twitterapi" data-lang="en" data-hashtags="hmdy">Tweet</a> | |
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> | |
</li> | |
</ul> | |
</span> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- BEGINNING of CONTAINER here--> | |
<div id="container"> | |
<div id="separator"><p>What People Are Saying</p></div> | |
<div id="section"> | |
<tbody id="thepost"> | |
<%= render "post" %> | |
</tbody> | |
<div id="paginkamari" align="center"><p><%= paginate @microposts, :remote => :true %></p></div> | |
</div> | |
<div id="footer"> | |
<p>About Advertising Contact us</p> | |
</div> | |
</div> | |
<!-- END of CONTAINER here--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#thepost').html('<%= escape_javascript render("post") %>'); | |
$('#paginkamari').html('<%= escape_javascript(paginate(@microposts, :remote => true).to_s) %>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def index | |
@title = "Home" | |
@microposts = Micropost.order("created_at").page(params[:page]).per(6) | |
respond_to do |format| | |
format.html | |
format.js | |
format.xml { render :xml => @microposts } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment