Merge branch 'szzh' into develop

This commit is contained in:
huang 2015-11-06 14:58:39 +08:00
commit acc93e6245
10 changed files with 44 additions and 18 deletions

View File

@ -147,6 +147,9 @@ class HomeworkCommonController < ApplicationController
else else
@statue = 3 @statue = 3
end 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 end
#关闭匿评 #关闭匿评
@ -162,6 +165,9 @@ class HomeworkCommonController < ApplicationController
# 匿评关闭消息邮件通知 # 匿评关闭消息邮件通知
send_message_anonymous_comment(@homework, m_status = 3) send_message_anonymous_comment(@homework, m_status = 3)
Mailer.send_mail_anonymous_comment_close(@homework).deliver 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| respond_to do |format|
format.js format.js
end end
@ -188,6 +194,9 @@ class HomeworkCommonController < ApplicationController
@homework.student_works.map { |work| @cur_size += work.student_works_scores.where(:reviewer_role => 3).count} @homework.student_works.map { |work| @cur_size += work.student_works_scores.where(:reviewer_role => 3).count}
end end
@percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100) @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| respond_to do |format|
format.js format.js
end end

View File

@ -272,6 +272,7 @@ class WordsController < ApplicationController
format.js{ format.js{
@user_activity_id = params[:user_activity_id] @user_activity_id = params[:user_activity_id]
@is_in_course = params[:is_in_course] @is_in_course = params[:is_in_course]
@course_activity = params[:course_activity]
@homework_common_id = params[:homework_common_id] @homework_common_id = params[:homework_common_id]
} }
end end

View File

@ -2307,15 +2307,15 @@ module ApplicationHelper
end 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") 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 => "作业截止日期之前不可以启动匿评" link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评"
elsif homework.student_works.count >= 2 && homework.homework_detail_manual#作业份数大于2 elsif homework.student_works.count >= 2 && homework.homework_detail_manual#作业份数大于2
case homework.homework_detail_manual.comment_status case homework.homework_detail_manual.comment_status
when 1 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 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 when 3
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束" # link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
end end

View File

@ -57,12 +57,12 @@ module HomeworkCommonHelper
end 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 = "" link = ""
if homework_detail_manual.comment_status == 1 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 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 end
link link
end end

View File

@ -34,7 +34,7 @@
</p> </p>
<% end %> <% end %>
<div class="ni_btn"> <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;" >
确&nbsp;&nbsp;定 确&nbsp;&nbsp;定
</a> </a>
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;"> <a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;">

View File

@ -1,12 +1,19 @@
<% if @statue == 1%> <% if @statue == 1%>
alert('启动成功'); 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 %> <% elsif @statue == 2 %>
alert('启动失败\n作业总数大于等于2份时才能启动匿评'); alert('启动失败\n作业总数大于等于2份时才能启动匿评');
<% elsif @statue == 3%> <% elsif @statue == 3%>
alert("已开启匿评,请务重复开启"); alert("已开启匿评,请务重复开启");
<% elsif @statue == 4%> <% elsif @statue == 4%>
alert("您没有权限开启匿评"); alert("您没有权限开启匿评");
<% elsif @statue == 5%> <% elsif @statue == 5%>
alert("作业提交截止之后才能启动匿评"); alert("作业提交截止之后才能启动匿评");
<% end %> <% end %>

View File

@ -1,2 +1,10 @@
$("#<%= @homework.id %>_stop_anonymous_comment").replaceWith('');
alert('关闭成功'); 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('');*/

View File

@ -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%> <%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
</li> </li>
<li> <li>
<%= homework_anonymous_comment activity %> <%= homework_anonymous_comment activity,-1,user_activity_id,course_activity %>
</li> </li>
<% end %> <% end %>
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%> <% 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;"> <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|%> <%= 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 '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> <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> <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> <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>

View File

@ -100,7 +100,7 @@
<% end %> <% end %>
<% if homework_common.anonymous_comment == 0%> <% if homework_common.anonymous_comment == 0%>
<li> <li>
<%= homework_anonymous_comment homework_common %> <%= homework_anonymous_comment(homework_common, is_in_course) %>
</li> </li>
<% end %> <% end %>
<% if homework_common.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%> <% if homework_common.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>

View File

@ -1,5 +1,5 @@
<% if @user_activity_id %> <% 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%"); init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
<% elsif @homework_common_id && @is_in_course %> <% 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}) %>"); $("#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}) %>");