Added pagination to topic#show
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -24,6 +24,8 @@ gem 'cancan'
|
|||||||
gem 'gravtastic', :git => 'https://github.com/chrislloyd/gravtastic.git'
|
gem 'gravtastic', :git => 'https://github.com/chrislloyd/gravtastic.git'
|
||||||
gem 'bb-ruby'
|
gem 'bb-ruby'
|
||||||
|
|
||||||
|
gem 'kaminari-bootstrap'
|
||||||
|
|
||||||
group :production do
|
group :production do
|
||||||
gem 'unicorn'
|
gem 'unicorn'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -59,6 +59,12 @@ GEM
|
|||||||
i18n (0.6.1)
|
i18n (0.6.1)
|
||||||
journey (1.0.4)
|
journey (1.0.4)
|
||||||
json (1.7.6)
|
json (1.7.6)
|
||||||
|
kaminari (0.14.1)
|
||||||
|
actionpack (>= 3.0.0)
|
||||||
|
activesupport (>= 3.0.0)
|
||||||
|
kaminari-bootstrap (0.1.3)
|
||||||
|
kaminari (>= 0.13.0)
|
||||||
|
rails
|
||||||
kgio (2.8.0)
|
kgio (2.8.0)
|
||||||
mail (2.4.4)
|
mail (2.4.4)
|
||||||
i18n (>= 0.4.0)
|
i18n (>= 0.4.0)
|
||||||
@@ -133,6 +139,7 @@ DEPENDENCIES
|
|||||||
execjs
|
execjs
|
||||||
forum_monster (~> 1.0.3)
|
forum_monster (~> 1.0.3)
|
||||||
gravtastic!
|
gravtastic!
|
||||||
|
kaminari-bootstrap
|
||||||
mysql2
|
mysql2
|
||||||
rails (= 3.2.11)
|
rails (= 3.2.11)
|
||||||
sass-rails (~> 3.2.3)
|
sass-rails (~> 3.2.3)
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ class TopicsController < ApplicationController
|
|||||||
def show
|
def show
|
||||||
@topic.hit! if @topic
|
@topic.hit! if @topic
|
||||||
|
|
||||||
|
@posts = @topic.posts.page(params[:page]).per(10)
|
||||||
|
#Kaminari.paginate_array(@topic).page(params[:page]).per(10)
|
||||||
|
|
||||||
@my_blockquote = {
|
@my_blockquote = {
|
||||||
'Quote' => [
|
'Quote' => [
|
||||||
/\[quote(:.*)?=(.*?)\](.*?)\[\/quote\1?\]/mi,
|
/\[quote(:.*)?=(.*?)\](.*?)\[\/quote\1?\]/mi,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<table>
|
<table>
|
||||||
<% @topic.posts.each do |post| %>
|
<% @posts.each do |post| %>
|
||||||
<% if !post.user.blank? %>
|
<% if !post.user.blank? %>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="post_author" rowspan="2">
|
<td class="post_author" rowspan="2">
|
||||||
@@ -41,6 +41,9 @@
|
|||||||
<%end%>
|
<%end%>
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</table>
|
||||||
|
<div style="text-align: center">
|
||||||
|
<%= paginate(@posts)%>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right controls"><p><%= link_to "Back to Forum", forum_path(@topic.forum) %></p></div>
|
<div class="right controls"><p><%= link_to "Back to Forum", forum_path(@topic.forum) %></p></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user