From c073e56b79a7018326c090399f062f2c196ab67f Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 18 Dec 2015 20:46:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=8C=BF=E8=AF=84?= =?UTF-8?q?=E5=BF=85=E9=A1=BB=E6=B7=BB=E5=8A=A0=E8=AF=84=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_add_score.html.erb | 24 +++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb index 0258b3b83..6302bb81e 100644 --- a/app/views/student_work/_add_score.html.erb +++ b/app/views/student_work/_add_score.html.erb @@ -1,7 +1,8 @@ <%= form_for('new_form', :remote => true, :method => :post,:url => add_score_student_work_path(work.id)) do |f|%>
  • 评价: - <%= f.text_area 'user_message', :class => 'hwork_ping_text', :placeholder => l(:text_caracters_maximum,:count=>250),:maxlength => 250 %> + <%= f.text_area 'user_message',:id =>"new_form_user_message_#{work.id}", :class => 'hwork_ping_text', :placeholder => l(:text_caracters_maximum,:count=>250),:maxlength => 250 %> +

  • @@ -16,7 +17,24 @@ <%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %> <%end%> - 提交 + 提交
  • -<% end%> \ No newline at end of file +<% end%> + \ No newline at end of file From 65022f03cbdd9a6f3cb0ee4711b62503115608cc Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 18 Dec 2015 21:34:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E8=AF=84=E5=88=86=E8=AE=BE=E7=BD=AE=E5=92=8C?= =?UTF-8?q?=E5=8C=BF=E8=AF=84=E8=87=AA=E5=8A=A8=E5=BC=80=E5=90=AF=E3=80=81?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E6=97=B6=E9=97=B4=E7=9A=84=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 13 +++++++++- .../_set_evalutation_att.html.erb | 2 +- .../set_evaluation_attr.js.erb | 9 ++++++- .../start_anonymous_comment.js.erb | 2 ++ .../start_evaluation_set.js.erb | 2 +- .../stop_anonymous_comment.js.erb | 2 ++ app/views/student_work/_add_score.html.erb | 24 +++---------------- app/views/student_work/set_score_rule.js.erb | 2 +- app/views/users/_course_homework.html.erb | 6 ++--- .../users/_user_homework_detail.html.erb | 6 ++--- 10 files changed, 36 insertions(+), 32 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index acc174659..048f62296 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -175,6 +175,7 @@ class HomeworkCommonController < ApplicationController end end @homework_detail_manual.update_column('comment_status', 2) + @homework_detail_manual.update_column('evaluation_start', Date.today) @statue = 1 # 匿评开启消息邮件通知 send_message_anonymous_comment(@homework, m_status = 2) @@ -194,6 +195,7 @@ class HomeworkCommonController < ApplicationController #关闭匿评 def stop_anonymous_comment @homework_detail_manual.update_column('comment_status', 3) + @homework_detail_manual.update_column('evaluation_end', Date.today) #计算缺评扣分 work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")" @homework.student_works.each do |student_work| @@ -274,7 +276,13 @@ class HomeworkCommonController < ApplicationController #启动匿评参数设置 def start_evaluation_set - + if params[:user_activity_id] + @user_activity_id = params[:user_activity_id] + else + @user_activity_id = -1 + end + @is_in_course = params[:is_in_course] + @course_activity = params[:course_activity].to_i end #设置匿评参数 @@ -290,6 +298,9 @@ class HomeworkCommonController < ApplicationController @homework_detail_manual.evaluation_num = params[:evaluation_num] @homework_detail_manual.save + @user_activity_id = params[:user_activity_id].to_i + @is_in_course = params[:is_in_course].to_i + @course_activity = params[:course_activity].to_i end end diff --git a/app/views/homework_common/_set_evalutation_att.html.erb b/app/views/homework_common/_set_evalutation_att.html.erb index d51713e9a..59df88680 100644 --- a/app/views/homework_common/_set_evalutation_att.html.erb +++ b/app/views/homework_common/_set_evalutation_att.html.erb @@ -1,5 +1,5 @@
    - <%= form_for('new_form',:url => {:controller => 'homework_common',:action => 'set_evaluation_attr',:homework => @homework.id},:method => "post",:remote => true) do |f|%> + <%= form_for('new_form',:url => {:controller => 'homework_common',:action => 'set_evaluation_attr',:homework => @homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity},:method => "post",:remote => true) do |f|%> 匿评设置
    diff --git a/app/views/homework_common/set_evaluation_attr.js.erb b/app/views/homework_common/set_evaluation_attr.js.erb index d6ab73df5..73436750c 100644 --- a/app/views/homework_common/set_evaluation_attr.js.erb +++ b/app/views/homework_common/set_evaluation_attr.js.erb @@ -1 +1,8 @@ -clickCanel(); \ No newline at end of file +clickCanel(); +<% if @user_activity_id != -1 %> +$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@courae_activity}) %>"); +init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); +<% else %> +$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>"); +init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); +<% end %> \ No newline at end of file diff --git a/app/views/homework_common/start_anonymous_comment.js.erb b/app/views/homework_common/start_anonymous_comment.js.erb index ffeda2cb5..8b2e9ed04 100644 --- a/app/views/homework_common/start_anonymous_comment.js.erb +++ b/app/views/homework_common/start_anonymous_comment.js.erb @@ -2,9 +2,11 @@ alert('启动成功'); <% if @user_activity_id == -1 %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); + $("#evaluation_start_time_<%=@homework.id %>").html("匿评开启时间:<%=format_time(Time.now) %>"); init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); + $("#evaluation_start_time_<%=@user_activity_id %>").html("匿评开启时间:<%=format_time(Time.now) %>"); init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); <% end %> /*$("#<%#= @homework.id %>_start_anonymous_comment").replaceWith('<%#= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "postOptionLink")%>');*/ diff --git a/app/views/homework_common/start_evaluation_set.js.erb b/app/views/homework_common/start_evaluation_set.js.erb index aac4ecd66..2a260dc4d 100644 --- a/app/views/homework_common/start_evaluation_set.js.erb +++ b/app/views/homework_common/start_evaluation_set.js.erb @@ -1,4 +1,4 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att') %>'); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:course_activity =>@course_activity,:remote=>true}) %>'); var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}; showModal('ajax-modal', '350px'); $('#ajax-modal').siblings().remove(); diff --git a/app/views/homework_common/stop_anonymous_comment.js.erb b/app/views/homework_common/stop_anonymous_comment.js.erb index 308e8a39f..2f8d8c6d6 100644 --- a/app/views/homework_common/stop_anonymous_comment.js.erb +++ b/app/views/homework_common/stop_anonymous_comment.js.erb @@ -1,9 +1,11 @@ alert('关闭成功'); <% if @user_activity_id == -1 %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); +$("#evaluation_end_time_<%=@homework.id %>").html("匿评关闭时间:<%=format_time(Time.now) %>"); init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); +$("#evaluation_end_time_<%=@user_activity_id %>").html("匿评关闭时间:<%=format_time(Time.now) %>"); init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity'); <% end %> /* diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb index 6302bb81e..0258b3b83 100644 --- a/app/views/student_work/_add_score.html.erb +++ b/app/views/student_work/_add_score.html.erb @@ -1,8 +1,7 @@ <%= form_for('new_form', :remote => true, :method => :post,:url => add_score_student_work_path(work.id)) do |f|%>
  • 评价: - <%= f.text_area 'user_message',:id =>"new_form_user_message_#{work.id}", :class => 'hwork_ping_text', :placeholder => l(:text_caracters_maximum,:count=>250),:maxlength => 250 %> -

    + <%= f.text_area 'user_message', :class => 'hwork_ping_text', :placeholder => l(:text_caracters_maximum,:count=>250),:maxlength => 250 %>
  • @@ -17,24 +16,7 @@ <%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %>
  • <%end%> - 提交 + 提交
    -<% end%> - \ No newline at end of file +<% end%> \ No newline at end of file diff --git a/app/views/student_work/set_score_rule.js.erb b/app/views/student_work/set_score_rule.js.erb index db9fd6d66..52a13f632 100644 --- a/app/views/student_work/set_score_rule.js.erb +++ b/app/views/student_work/set_score_rule.js.erb @@ -1,5 +1,5 @@ clickCanel(); -<% if @user_activity_id %> +<% if @user_activity_id != -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@courae_activity}) %>"); init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); <% else %> diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index f02105fb6..33286c8fc 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -102,7 +102,7 @@
    迟交扣分:<%= activity.late_penalty%>分
    -
    +
    匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%> 00:00
    @@ -111,7 +111,7 @@
    缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
    -
    +
    匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%> 23:59
    @@ -172,7 +172,7 @@ <% if activity.anonymous_comment == 0 %>
  • - <%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%> + <%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
  • <%= homework_anonymous_comment activity,-1,user_activity_id,course_activity %> diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 5bfe1814d..e49a7ed17 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -107,7 +107,7 @@
    迟交扣分:<%= homework_common.late_penalty%>分
    -
    +
    匿评开启时间:<%= homework_common.homework_detail_manual.evaluation_start%> 00:00
    @@ -116,7 +116,7 @@
    缺评扣分:<%= homework_common.homework_detail_manual.absence_penalty%>分/作品
    -
    +
    匿评关闭时间:<%= homework_common.homework_detail_manual.evaluation_end%> 23:59
    @@ -177,7 +177,7 @@
  • <% if homework_common.anonymous_comment == 0 &&(comment_status == 0 || comment_status == 1)%>
  • - <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common),:class => "postOptionLink", :remote => true)%> + <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true)%>
  • <% end %> <% if homework_common.anonymous_comment == 0%>