diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 809bf73ac..55bac3e46 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -758,22 +758,26 @@ class CoursesController < ApplicationController def homework if @course.is_public != 0 || User.current.member_of_course?(@course) || User.current.admin? - @offset, @limit = api_offset_and_limit({:limit => 10}) - @bids = @course.homeworks.order('deadline DESC') - @bids = @bids.like(params[:name]) if params[:name].present? - @bid_count = @bids.count - @bid_pages = Paginator.new @bid_count, @limit, params['page'] - - @offset ||= @bid_pages.reverse_offset - unless @offset == 0 - @bids = @bids.offset(@offset).limit(@limit).all.reverse - else - limit = @bid_count % @limit - if limit == 0 - limit = 10 - end - @bids = @bids.offset(@offset).limit(limit).all.reverse - end + bids = @course.homeworks.order('created_on DESC') + bids = bids.like(params[:name]) if params[:name].present? + @bids = paginateHelper bids,10 + @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) + # + # @offset, @limit = api_offset_and_limit({:limit => 10}) + # + # @bid_count = @bids.count + # @bid_pages = Paginator.new @bid_count, @limit, params['page'] + # + # @offset ||= @bid_pages.reverse_offset + # unless @offset == 0 + # @bids = @bids.offset(@offset).limit(@limit).all.reverse + # else + # limit = @bid_count % @limit + # if limit == 0 + # limit = 10 + # end + # @bids = @bids.offset(@offset).limit(limit).all.reverse + # end render :layout => 'base_courses' else render_403 diff --git a/app/views/courses/homework.html.erb b/app/views/courses/homework.html.erb index 81201bef5..731e155ff 100644 --- a/app/views/courses/homework.html.erb +++ b/app/views/courses/homework.html.erb @@ -1,63 +1,36 @@ - -<%= javascript_include_tag 'attachments' %> - -
+ 共有<%= @obj_count%>个作业 +
+ <%= link_to( l(:label_course_homework_new), new_homework_course_path(@course), :class => 'problem_new_btn fl c_dorange') if @is_teacher %> +已提交的作业 (<%= link_to bid.homeworks.count, course_for_bid_path(bid.id), :class => 'c_red'%> )
+ 关闭匿评编辑 + +项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题
创建时间 : 2014-11-26 10:19