From fde4ce74ba5378eb2d8b8ac5f4210043979a0535 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 23 Oct 2015 14:45:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E9=85=8D=E7=BD=AE=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E5=A2=9E=E5=8A=A0=E8=AF=84=E5=88=86=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 9 +++++++-- app/controllers/student_work_controller.rb | 8 +++++++- app/views/homework_common/score_rule_set.js.erb | 6 ++++++ app/views/student_work/_set_score_rule.html.erb | 3 +++ app/views/student_work/index.html.erb | 2 +- app/views/users/_user_homework_detail.html.erb | 3 +++ config/routes.rb | 1 + 7 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 app/views/homework_common/score_rule_set.js.erb diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 9e3a4b836..7793ef097 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -6,8 +6,8 @@ class HomeworkCommonController < ApplicationController include StudentWorkHelper before_filter :find_course, :only => [:index,:new,:create] - before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr] - before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr] + before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set] + before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr,:score_rule_set] before_filter :member_of_course, :only => [:index] def index @@ -215,6 +215,11 @@ class HomeworkCommonController < ApplicationController end end + #评分设置 + def score_rule_set + + end + private #获取课程 def find_course diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index e5e1bf391..529c5ea72 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -457,7 +457,13 @@ class StudentWorkController < ApplicationController end end respond_to do |format| - format.html{redirect_to student_work_index_url(:homework => @homework.id)} + format.html{ + if params[:student_path] + redirect_to student_work_index_url(:homework => @homework.id) + else + redirect_to user_homeworks_user_path(User.current.id) + end + } end end diff --git a/app/views/homework_common/score_rule_set.js.erb b/app/views/homework_common/score_rule_set.js.erb new file mode 100644 index 000000000..5ff42dff7 --- /dev/null +++ b/app/views/homework_common/score_rule_set.js.erb @@ -0,0 +1,6 @@ +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework, :student_path => false}) %>'); +showModal('ajax-modal', '350px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed"); \ No newline at end of file diff --git a/app/views/student_work/_set_score_rule.html.erb b/app/views/student_work/_set_score_rule.html.erb index 7deed7fb8..508b89a1c 100644 --- a/app/views/student_work/_set_score_rule.html.erb +++ b/app/views/student_work/_set_score_rule.html.erb @@ -1,4 +1,7 @@ <%= form_for('new_form',:url => {:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id},:method => "post") do |f|%> + <% if student_path %> + <%=hidden_field_tag 'student_path', params[:student_path], :value => student_path %> + <% end %>
评分设置
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 72ca36ca9..0ea5e7055 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -20,7 +20,7 @@ //设置评分规则 function set_score_rule(){ - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework}) %>'); + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework,:student_path => true}) %>'); showModal('ajax-modal', '350px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 848417d3e..b4beb7aa3 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -68,6 +68,9 @@
  • <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => is_in_course),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
  • +
  • + <%= link_to("评分设置", score_rule_set_homework_common_path(homework_common),:class => "postOptionLink", :remote => true) %> +
  • <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common),:class => "postOptionLink", :remote => true) if homework_common.homework_detail_manual.comment_status == 1%>
  • diff --git a/config/routes.rb b/config/routes.rb index 649cfbb75..f7edee954 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -102,6 +102,7 @@ RedmineApp::Application.routes.draw do get 'stop_anonymous_comment' get 'alert_anonymous_comment' get 'start_evaluation_set' + get 'score_rule_set' post 'set_evaluation_attr' end collection do