增加作业留言的分页显示

This commit is contained in:
sw 2014-05-22 20:01:26 +08:00
parent 5d4226ce79
commit 71bbc50542
3 changed files with 16 additions and 8 deletions

View File

@ -101,8 +101,8 @@ class HomeworkAttachController < ApplicationController
@stars_status_map["star#{star_status.stars.to_i}".to_sym] =
percent_m.to_s + "%"
end
@jours = @homework.journals_for_messages.order("created_on DESC")
@limit = 10
@jours = @homework.journals_for_messages.order("created_on DESC")
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@ -129,11 +129,11 @@ class HomeworkAttachController < ApplicationController
@homework = HomeworkAttach.find(params[:jour_id])
@homework.addjours User.current.id, params[:new_form][:user_message],0
@jours = @homework.journals_for_messages.order("created_on DESC")
#@limit = 10
#@feedback_count = @jours.count
#@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
#@offset ||= @feedback_pages.offset
#@jour = @jours[@offset, @limit]
@limit = 10
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
respond_to do |format|
format.js
end

View File

@ -1,4 +1,4 @@
$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jours, :state => false} )) %>');
$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false} )) %>');
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
$('#new_form_user_message').val("");
$('#new_form_reference_user_id').val("");

View File

@ -142,7 +142,15 @@
<!-- 留言列表区 -->
<div id="message" style="font-size: 14px;">
<%= render :partial => 'showjour', :locals => {:jour => @jours} %>
<%= render :partial => 'showjour', :locals => {:jour => @jour} %>
</div>
<!--分页-->
<div class="pagination" style="float:left;">
<ul>
<%= pagination_links_full @feedback_pages %>
</ul>
</div>
<div>
</div>