From 7ba27026ae4024a9536e03a787b12a3455a62e75 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 19 Sep 2015 10:45:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=99=E5=B8=88=E5=9C=A8=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=86=85=E7=BC=96=E8=BE=91=E3=80=81=E5=88=A0=E9=99=A4=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E4=B9=8B=E5=90=8E=E4=BB=8D=E7=84=B6=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E5=9B=9E=E5=BD=93=E5=89=8D=E8=AF=BE=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 15 +++++++++++++-- app/views/homework_common/edit.html.erb | 1 + app/views/homework_common/index.html.erb | 4 ++-- app/views/users/_user_homework_list.html.erb | 4 ++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 35d6f2b85..5530886df 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -137,6 +137,7 @@ class HomeworkCommonController < ApplicationController def edit @user = User.current + @is_in_course = params[:is_in_course] respond_to do |format| format.html{render :layout => 'new_base_user'} end @@ -173,7 +174,11 @@ class HomeworkCommonController < ApplicationController if @homework.save @homework_detail_manual.save if @homework_detail_manual @homework_detail_programing.save if @homework_detail_programing - redirect_to user_homeworks_user_path(User.current.id) + if params[:is_in_course] == "1" + redirect_to homework_common_index_path(:course => @course.id) + else + redirect_to user_homeworks_user_path(User.current.id) + end end end end @@ -181,7 +186,13 @@ class HomeworkCommonController < ApplicationController def destroy if @homework.destroy respond_to do |format| - format.html {redirect_to user_homeworks_user_path(User.current.id)} + format.html { + if params[:is_in_course] == "1" + redirect_to homework_common_index_path(:course => @course.id) + else + redirect_to user_homeworks_user_path(User.current.id) + end + } end end end diff --git a/app/views/homework_common/edit.html.erb b/app/views/homework_common/edit.html.erb index d6815a00a..5fc11728b 100644 --- a/app/views/homework_common/edit.html.erb +++ b/app/views/homework_common/edit.html.erb @@ -16,6 +16,7 @@
<%= form_for @homework do |f| %> +
<%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index d7723452b..693ddba65 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -26,8 +26,8 @@

<% if @is_teacher%> <%= homework_anonymous_comment(homework)%> - <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %> - <%= link_to(l(:button_edit),edit_homework_common_path(homework), :class => "fr mr10 work_edit") %> + <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework,:is_in_course => 1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %> + <%= link_to(l(:button_edit),edit_homework_common_path(homework,:is_in_course => 1), :class => "fr mr10 work_edit") %> <% elsif @is_student%> <%= student_anonymous_comment homework %> <%= student_new_homework homework %> diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index c6e827291..e7addad97 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -59,10 +59,10 @@