发布和编辑作业时可设置是否启用匿评
This commit is contained in:
parent
b8d8cece02
commit
7f133c860a
|
@ -63,6 +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_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
|
||||
if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0
|
||||
|
|
|
@ -522,6 +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.homework_type = params[:homework_type].to_i || 1
|
||||
homework.late_penalty = 10
|
||||
homework.teacher_priority = 1
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
$("#homework_name").val("");
|
||||
$("#homework_publish_time").val("");
|
||||
$("#homework_end_time").val("");
|
||||
document.getElementById("anonymous_comment").checked = true;
|
||||
$("#course_id").val($("#option_select").val());
|
||||
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true,:has_group => true})%>");
|
||||
homework_description_editor.html("");
|
||||
|
|
|
@ -4,11 +4,23 @@
|
|||
<%= javascript_include_tag 'homework','baiduTemplate' %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
if($.trim($("#anonymous_comment").val()) == 1) {
|
||||
$("#anonymous_comment").attr('checked',false);
|
||||
} else {
|
||||
$("#anonymous_comment").attr('checked',true);
|
||||
}
|
||||
$("#BluePopupBox a.BlueCirBtn").click();
|
||||
<% if edit_mode && homework.is_group_homework? %>
|
||||
$("#GroupPopupBox a.group_btn").click();
|
||||
<% end %>
|
||||
});
|
||||
function checked_val() {
|
||||
if ($("#anonymous_comment").is(":checked")) {
|
||||
$("#anonymous_comment").val(0);
|
||||
} else {
|
||||
$("#anonymous_comment").val(1);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
|
@ -39,6 +51,12 @@
|
|||
<%= calendar_for('homework_publish_time')%>
|
||||
<% end %>
|
||||
</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>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<p id="homework_end_time_span" class="c_red mt5"></p>
|
||||
|
@ -68,12 +86,12 @@
|
|||
|
||||
<div class="mt5">
|
||||
<% if edit_mode %>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_homework('edit_homework_common_<%= homework.id%>');">确定</a>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="checked_val();submit_homework('edit_homework_common_<%= homework.id%>');">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<%#= link_to "取消",user_homeworks_user_path(User.current.id),:class => "fr mr10 mt3"%>
|
||||
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="cancel_edit();">取消</a>
|
||||
<% else %>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_homework('new_homework_common');">发送</a>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="checked_val();submit_homework('new_homework_common');">发送</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<a href="javascript:void(0);" class=" fr mr10 mt3" onclick="reset_homework();">取消</a>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue