班级动态只有10条,底部却显示“点击展开更多”

This commit is contained in:
cxt 2016-07-22 16:50:32 +08:00
parent 27fa113de1
commit 808b553e43
2 changed files with 11 additions and 9 deletions

View File

@ -888,23 +888,25 @@ class CoursesController < ApplicationController
if params[:type].present?
case params[:type]
when "homework"
@course_activities = course_activities.where("course_act_type = 'HomeworkCommon'").order('updated_at desc').limit(10).offset(@page * 10)
@course_activities = course_activities.where("course_act_type = 'HomeworkCommon'").order('updated_at desc')
when "news"
@course_activities = course_activities.where("course_act_type = 'News'").order('updated_at desc').limit(10).offset(@page * 10)
@course_activities = course_activities.where("course_act_type = 'News'").order('updated_at desc')
when "message"
@course_activities = course_activities.where("course_act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10)
@course_activities = course_activities.where("course_act_type = 'Message'").order('updated_at desc')
when "poll"
@course_activities = course_activities.where("course_act_type = 'Poll'").order('updated_at desc').limit(10).offset(@page * 10)
@course_activities = course_activities.where("course_act_type = 'Poll'").order('updated_at desc')
when "attachment"
@course_activities = course_activities.where("course_act_type = 'Attachment'").order('updated_at desc').limit(10).offset(@page * 10)
@course_activities = course_activities.where("course_act_type = 'Attachment'").order('updated_at desc')
when "journalsForMessage"
@course_activities = course_activities.where("course_act_type = 'JournalsForMessage'").order('updated_at desc').limit(10).offset(@page * 10)
@course_activities = course_activities.where("course_act_type = 'JournalsForMessage'").order('updated_at desc')
else
@course_activities = course_activities.order('updated_at desc').limit(10).offset(@page * 10)
@course_activities = course_activities.order('updated_at desc')
end
else
@course_activities = course_activities.order('updated_at desc').limit(10).offset(@page * 10)
@course_activities = course_activities.order('updated_at desc')
end
@course_activities_count = @course_activities.count
@course_activities = @course_activities.limit(10).offset(@page * 10)
@type = params[:type]
@left_nav_type = 1

View File

@ -78,7 +78,7 @@
<% end %>
<% end %>
<% if course_activities.count == 10 %>
<% if course_activities.count + page * 10 < @course_activities_count %>
<!--<div id="show_more_course_activities" class="loadMore mt10 f_grey">点击展开更多<%#= link_to "", course_activity_path(@course.id, :type => type, :page => page), :id => "more_course_activities_link", :remote => "true", :class => "none" %></div>-->
<%= link_to "点击展开更多",course_activity_path(@course.id, :type => type, :page => page),:id => "show_more_course_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end %>