讨论区留言分页

sw_new_course
z9hang 11 years ago
parent 57dad3f3c7
commit 35eb7e80af

@ -44,6 +44,26 @@ class MessagesController < ApplicationController
end end
@reply_count = @topic.children.count @reply_count = @topic.children.count
# @reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
# @replies = @topic.children.
# includes(:author, :attachments, {:board => :project}).
# reorder("#{Message.table_name}.created_on DESC").
# limit(@reply_pages.per_page).
# offset(@reply_pages.offset).
# all
@reply = Message.new(:subject => "RE: #{@message.subject}")
if @course
messages_replies = @topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").
#limit(@reply_pages.per_page).
#offset(@reply_pages.offset).
all
@replies = paginateHelper messages_replies,10
@reply = Message.new(:subject => "RE: #{@message.subject}")
render :action => "show", :layout => "base_courses"#by young
else
@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page @reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
@replies = @topic.children. @replies = @topic.children.
includes(:author, :attachments, {:board => :project}). includes(:author, :attachments, {:board => :project}).
@ -53,9 +73,6 @@ class MessagesController < ApplicationController
all all
@reply = Message.new(:subject => "RE: #{@message.subject}") @reply = Message.new(:subject => "RE: #{@message.subject}")
if @course
render :action => "show", :layout => "base_courses"#by young
else
render :action => "show", :layout => "base_projects"#by young render :action => "show", :layout => "base_projects"#by young
end end
end end

@ -148,7 +148,9 @@
<div id="preview" class="wiki"></div> <div id="preview" class="wiki"></div>
</div> </div>
<% end %> <% end %>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<% html_title @topic.subject %> <% html_title @topic.subject %>
<script type="text/javascript"> <script type="text/javascript">

Loading…
Cancel
Save