班级作业在匿评中无法看到匿评设置选项

This commit is contained in:
cxt 2017-04-18 09:59:13 +08:00
parent 7b2d9491b3
commit 56e67fa0c0
4 changed files with 20 additions and 14 deletions

View File

@ -584,13 +584,15 @@ class HomeworkCommonController < ApplicationController
@homework_detail_manual.evaluation_end = params[:evaluation_end]
end
evaluation_num = @homework_detail_manual.evaluation_num
if params[:evaluation_limit].to_i == 1
@homework_detail_manual.evaluation_num = params[:evaluation_num]
@homework_detail_manual.absence_penalty = evaluation_num == -1 ? 5 : @homework_detail_manual.absence_penalty
else
@homework_detail_manual.evaluation_num = -1
@homework_detail_manual.absence_penalty = 0
if params[:evaluation_limit] && params[:evaluation_num]
evaluation_num = @homework_detail_manual.evaluation_num
if params[:evaluation_limit].to_i == 1
@homework_detail_manual.evaluation_num = params[:evaluation_num]
@homework_detail_manual.absence_penalty = evaluation_num == -1 ? 5 : @homework_detail_manual.absence_penalty
else
@homework_detail_manual.evaluation_num = -1
@homework_detail_manual.absence_penalty = 0
end
end
@homework_detail_manual.save
@user_activity_id = params[:user_activity_id].to_i

View File

@ -1,18 +1,19 @@
<div id="muban_popup_box" style="width:550px;">
<%= form_for('new_form',:url => {:controller => 'homework_common',:action => 'set_evaluation_attr',:homework => @homework.id,:user_activity_id=>user_activity_id,:hw_status=>hw_status},: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,:hw_status=>hw_status},:method => "post",:remote => true) do |f|%>
<div class="muban_popup_top">
<h3 class="fl">匿评设置</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<% not_allow_edit = @homework.homework_detail_manual.comment_status == 2 %>
<div class="muban_popup_con clear">
<div class="clear mt15 ml20">
<ul class="pro_newsetting_con fl">
<li class="mb10 clear">
<label class="fl pop_box_label">开启匿评&nbsp;&nbsp;:&nbsp;</label>
<div class="calendar_div fl">
<input type="text" name="evaluation_start" id="evaluation_start_time" placeholder="开启匿评日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= @homework_detail_manual.evaluation_start%>"/>
<input type="text" name="evaluation_start" id="evaluation_start_time" placeholder="开启匿评日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= @homework_detail_manual.evaluation_start%>"/>
<%#= calendar_for('evaluation_start_time')%>
</div>
<div class="cl"></div>
@ -29,15 +30,15 @@
</li>
<li class="mb10 clear">
<label class="fl pop_box_label">&nbsp;匿评人数&nbsp;&nbsp;:&nbsp;</label>
<input type="radio" class="fl" value="1" name="evaluation_limit" id="limit"/>
<input <%= not_allow_edit ? 'disabled' : '' %> type="radio" class="fl" value="1" name="evaluation_limit" id="limit"/>
<label for="limit" class="fl ml5">限定</label>
<input type="text" name="evaluation_num" id="evaluation_num" maxlength="2" class="radio-width90 fl ml10" value="<%= @homework_detail_manual.evaluation_num == -1 ? 3 : @homework_detail_manual.evaluation_num%>"/>
<input <%= not_allow_edit ? 'disabled' : '' %> type="text" name="evaluation_num" id="evaluation_num" maxlength="2" class="radio-width90 fl ml10" value="<%= @homework_detail_manual.evaluation_num == -1 ? 3 : @homework_detail_manual.evaluation_num%>"/>
<div class="cl"></div>
<p id="evaluation_num_notice" class="c_red ml100"></p>
</li>
<li class="mb10 clear">
<label class="fl pop_box_label">&nbsp;&nbsp;</label>
<input type="radio" class="fl" value="0" name="evaluation_limit" id="no_limit"/>
<input <%= not_allow_edit ? 'disabled' : '' %> type="radio" class="fl" value="0" name="evaluation_limit" id="no_limit"/>
<label for="no_limit" class="fl ml5">不限定</label>
</li>
</ul>

View File

@ -1,6 +1,9 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>";
pop_box_new(htmlvalue, 550, 315);
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};
$(function() { $('#evaluation_start_time').datepicker(datepickerOptions);
$(function() {
<% if @homework.homework_detail_manual.comment_status < 2 %>
$('#evaluation_start_time').datepicker(datepickerOptions);
<% end %>
$('#evaluation_end_time').datepicker(datepickerOptions);
});

View File

@ -105,7 +105,7 @@
</li>
<% if activity.anonymous_comment == 0 %>
<li>
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "wpostOptionLink", :remote => true) if activity.homework_detail_manual.comment_status < 2%>
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "wpostOptionLink", :remote => true) if activity.homework_detail_manual.comment_status < 3%>
</li>
<li>
<%= homework_anonymous_comment activity,hw_status,user_activity_id %>