Added pagination to forums
This commit is contained in:
@@ -4,6 +4,10 @@ class ForumsController < ApplicationController
|
|||||||
|
|
||||||
before_filter :check_for_cancel
|
before_filter :check_for_cancel
|
||||||
|
|
||||||
|
def show
|
||||||
|
@topics = @forum.topics.page(params[:page]).per(10)
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
if @forum.save
|
if @forum.save
|
||||||
flash[:notice] = "Forum was successfully created."
|
flash[:notice] = "Forum was successfully created."
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% @forum.topics.each do |topic| %>
|
<% @topics.each do |topic| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="icon"><%= image_tag 'ruby.png' %></td>
|
<td class="icon"><%= image_tag 'ruby.png' %></td>
|
||||||
<td class="description">
|
<td class="description">
|
||||||
@@ -45,4 +45,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="text-align: center">
|
||||||
|
<%= paginate(@topics) %>
|
||||||
|
</div>
|
||||||
<div class="right controls"><p><%= link_to "Back to Forum List", forums_path %></p></div>
|
<div class="right controls"><p><%= link_to "Back to Forum List", forums_path %></p></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user