发布和编辑作业时的启用匿评改为禁用匿评,默认不选中

This commit is contained in:
cxt 2015-12-31 11:36:21 +08:00
parent ec631691e3
commit 2c5a4f8a13
3 changed files with 8 additions and 8 deletions

View File

@ -63,7 +63,7 @@ class HomeworkCommonController < ApplicationController
end
@homework.end_time = params[:homework_common][:end_time] || Time.now
@homework.course_id = params[:course_id]
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 1
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0

View File

@ -522,7 +522,7 @@ class UsersController < ApplicationController
else
homework.publish_time = params[:homework_common][:publish_time]
end
homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 1
homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0
homework.homework_type = params[:homework_type].to_i || 1
homework.late_penalty = 10
homework.teacher_priority = 1

View File

@ -5,9 +5,9 @@
<script type="text/javascript">
$(function(){
if($.trim($("#anonymous_comment").val()) == 1) {
$("#anonymous_comment").attr('checked',false);
} else {
$("#anonymous_comment").attr('checked',true);
} else {
$("#anonymous_comment").attr('checked',false);
}
$("#BluePopupBox a.BlueCirBtn").click();
<% if edit_mode && homework.is_group_homework? %>
@ -16,9 +16,9 @@
});
function checked_val() {
if ($("#anonymous_comment").is(":checked")) {
$("#anonymous_comment").val(0);
} else {
$("#anonymous_comment").val(1);
} else {
$("#anonymous_comment").val(0);
}
}
</script>
@ -53,8 +53,8 @@
</div>
<% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
<div class="fl f14 ml10" style="margin-top: 4px;">
<input type="checkbox" name="homework_common[anonymous_comment]" checked="checked" value="<%=edit_mode ? homework.anonymous_comment : 0 %>" id="anonymous_comment"/>
<span class="f14 c_grey mr10">用匿评</span>
<input type="checkbox" name="homework_common[anonymous_comment]" value="<%=edit_mode ? homework.anonymous_comment : 0 %>" id="anonymous_comment"/>
<span class="f14 c_grey mr10">用匿评</span>
</div>
<% end %>
</div>