From 3418c9cceeca14848b4a68b1a59bd1e79470df5f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 19 Mar 2015 17:28:36 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9course/homewrok?= =?UTF-8?q?=E6=96=B9=E6=B3=95=202=E3=80=81=E4=BF=AE=E6=94=B9course?= =?UTF-8?q?=E7=9A=84=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 36 ++++++----- app/views/courses/homework.html.erb | 91 ++++++++++----------------- public/javascripts/course.js | 19 +++++- 3 files changed, 70 insertions(+), 76 deletions(-) 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