From b935f50b36ac01595bdff84ee371822403ff4bc6 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 2 Jun 2015 15:20:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=86=85=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E3=80=81=E6=96=B0=E5=BB=BA=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E7=AD=89=E8=B7=AF=E7=94=B1=E5=85=B3=E9=97=AD=EF=BC=8C=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=A1=B5=E9=9D=A2=E3=80=81=E6=96=B9=E6=B3=95=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 26 -------- app/views/courses/homework.html.erb | 65 ------------------- app/views/courses/new_homework.html.erb | 4 -- config/routes.rb | 85 +------------------------ 4 files changed, 1 insertion(+), 179 deletions(-) delete mode 100644 app/views/courses/homework.html.erb delete mode 100644 app/views/courses/new_homework.html.erb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index d88815311..e2728f0c5 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -612,32 +612,6 @@ class CoursesController < ApplicationController end end - def homework - if @course.is_public != 0 || User.current.member_of_course?(@course) || User.current.admin? - 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)) - @is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher)) - render :layout => 'base_courses' - else - render_403 - end - end - - # 新建作业 - def new_homework - @homework = Bid.new - @homework.safe_attributes = params[:bid] - @homework.open_anonymous_evaluation = 1 - @homework.deadline = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] )) - render :layout => 'base_courses' - else - render_403 - end - end - def toggleCourse @course_prefs = Course.find_by_extra(@course.extra) unless (@course_prefs.teacher == User.current || User.current.admin?) diff --git a/app/views/courses/homework.html.erb b/app/views/courses/homework.html.erb deleted file mode 100644 index 32728adf0..000000000 --- a/app/views/courses/homework.html.erb +++ /dev/null @@ -1,65 +0,0 @@ -
- <%= l(:label_totle)%><%= @obj_count%><%= l(:label_homework_count)%> -
- <%= link_to( l(:label_course_homework_new), new_homework_course_path(@course), :class => 'problem_new_btn fl c_dorange') if @is_teacher %> - -<%= l(:lebel_homework_commit)%> ( <%= link_to bid.homeworks.count, course_for_bid_path(bid.id), :class => 'c_red'%> )
- <% if @is_teacher%> - <%= bid_anonymous_comment(bid)%> - <% if bid.homeworks.empty? %> - <%= link_to(l(:button_delete),bids_homework_path(:id => bid.id), :method => :delete, :confirm => l(:label_delete_confirm), :class => "fr mr10 work_edit") %> - <% end %> - <%= link_to(l(:button_edit),edit_bid_path(:course_id =>@course.id, :bid_id => bid.id), :class => "fr mr10 work_edit") %> - <% elsif @is_student%> - <%= student_anonymous_comment bid %> - <%= student_new_homework bid %> - <% end %> - - -