Merge branch 'szzh' into develop
This commit is contained in:
commit
acc93e6245
|
@ -147,6 +147,9 @@ class HomeworkCommonController < ApplicationController
|
|||
else
|
||||
@statue = 3
|
||||
end
|
||||
@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
|
||||
|
||||
#关闭匿评
|
||||
|
@ -162,6 +165,9 @@ class HomeworkCommonController < ApplicationController
|
|||
# 匿评关闭消息邮件通知
|
||||
send_message_anonymous_comment(@homework, m_status = 3)
|
||||
Mailer.send_mail_anonymous_comment_close(@homework).deliver
|
||||
@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
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -188,6 +194,9 @@ class HomeworkCommonController < ApplicationController
|
|||
@homework.student_works.map { |work| @cur_size += work.student_works_scores.where(:reviewer_role => 3).count}
|
||||
end
|
||||
@percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100)
|
||||
@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
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
|
@ -272,6 +272,7 @@ class WordsController < ApplicationController
|
|||
format.js{
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@is_in_course = params[:is_in_course]
|
||||
@course_activity = params[:course_activity]
|
||||
@homework_common_id = params[:homework_common_id]
|
||||
}
|
||||
end
|
||||
|
|
|
@ -2307,15 +2307,15 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
#获取匿评相关连接代码
|
||||
def homework_anonymous_comment homework
|
||||
def homework_anonymous_comment (homework, is_in_course, user_activity_id = -1, course_activity = -1)
|
||||
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
||||
link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评"
|
||||
elsif homework.student_works.count >= 2 && homework.homework_detail_manual#作业份数大于2
|
||||
case homework.homework_detail_manual.comment_status
|
||||
when 1
|
||||
link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
|
||||
link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
|
||||
when 2
|
||||
link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
|
||||
link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
|
||||
when 3
|
||||
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
|
||||
end
|
||||
|
|
|
@ -57,12 +57,12 @@ module HomeworkCommonHelper
|
|||
end
|
||||
|
||||
#根据传入作业确定跳转到开启匿评还是关闭匿评功能
|
||||
def alert_anonyoms_path homework,homework_detail_manual
|
||||
def alert_anonyoms_path homework,homework_detail_manual,user_activity_id,is_in_course,course_activity
|
||||
link = ""
|
||||
if homework_detail_manual.comment_status == 1
|
||||
link = start_anonymous_comment_homework_common_url homework.id
|
||||
link = start_anonymous_comment_homework_common_url homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity
|
||||
elsif homework_detail_manual.comment_status == 2
|
||||
link = stop_anonymous_comment_homework_common_url homework.id
|
||||
link = stop_anonymous_comment_homework_common_url homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity
|
||||
end
|
||||
link
|
||||
end
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
</p>
|
||||
<% end %>
|
||||
<div class="ni_btn">
|
||||
<a href="javascript:" class="tijiao" onclick="clickOK('<%= alert_anonyoms_path @homework,@homework_detail_manual%>');" style="margin-bottom: 20px;" >
|
||||
<a href="javascript:" class="tijiao" onclick="clickOK('<%= alert_anonyoms_path @homework,@homework_detail_manual,@user_activity_id,@is_in_course,@course_activity%>');" style="margin-bottom: 20px;" >
|
||||
确 定
|
||||
</a>
|
||||
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;">
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
<% if @statue == 1%>
|
||||
alert('启动成功');
|
||||
$("#<%= @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")%>');
|
||||
<% 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})%>");
|
||||
init_activity_KindEditor_data(<%= @homework.id%>,"","87%");
|
||||
<% 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}) %>");
|
||||
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
|
||||
<% 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")%>');*/
|
||||
<% elsif @statue == 2 %>
|
||||
alert('启动失败\n作业总数大于等于2份时才能启动匿评');
|
||||
<% elsif @statue == 3%>
|
||||
|
|
|
@ -1,2 +1,10 @@
|
|||
$("#<%= @homework.id %>_stop_anonymous_comment").replaceWith('');
|
||||
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})%>");
|
||||
init_activity_KindEditor_data(<%= @homework.id%>,"","87%");
|
||||
<% 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}) %>");
|
||||
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
|
||||
<% end %>
|
||||
/*
|
||||
$("#<%#= @homework.id %>_stop_anonymous_comment").replaceWith('');*/
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
|
||||
</li>
|
||||
<li>
|
||||
<%= homework_anonymous_comment activity %>
|
||||
<%= homework_anonymous_comment activity,-1,user_activity_id,course_activity %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
|
||||
|
@ -167,6 +167,7 @@
|
|||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%>
|
||||
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
|
||||
<%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="homework_message"></textarea>
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
<% end %>
|
||||
<% if homework_common.anonymous_comment == 0%>
|
||||
<li>
|
||||
<%= homework_anonymous_comment homework_common %>
|
||||
<%= homework_anonymous_comment(homework_common, is_in_course) %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if homework_common.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% if @user_activity_id %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id}) %>");
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>");
|
||||
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
|
||||
<% elsif @homework_common_id && @is_in_course %>
|
||||
$("#homework_common_<%= @homework_common_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework_common,:is_in_course => @is_in_course}) %>");
|
||||
|
|
Loading…
Reference in New Issue