新建作业的时候,必须先选择作业类型
This commit is contained in:
parent
4d7dbc1fc6
commit
db71b1578b
|
@ -3724,6 +3724,9 @@ end
|
|||
#作业类型
|
||||
def homework_type_option
|
||||
type = []
|
||||
option0 = []
|
||||
option0 << "请选择"
|
||||
option0 << 0
|
||||
option1 = []
|
||||
option1 << "普通作业"
|
||||
option1 << 1
|
||||
|
@ -3733,6 +3736,7 @@ def homework_type_option
|
|||
option3 = []
|
||||
option3 << "分组作业"
|
||||
option3 << 3
|
||||
type << option0
|
||||
type << option1
|
||||
type << option2
|
||||
type << option3
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
$("#homework_end_time_span").text("");
|
||||
$("#homework_course_id_span").text("");
|
||||
$("#homework_editor").toggle();
|
||||
$("#select_type_nitice").show();
|
||||
document.getElementById("homework_type_option").options[0].selected = true;
|
||||
}
|
||||
|
||||
$(function(){
|
||||
|
|
|
@ -6,17 +6,23 @@
|
|||
<script type="text/javascript">
|
||||
var first_click = true;
|
||||
$(function(){
|
||||
$("#homework_type_option").on("change",function(){
|
||||
$("#homework_type_option").on("change",function(){
|
||||
$('#homework_editor').show();
|
||||
var type = $(this).children('option:selected').val();
|
||||
if(type == "1"){
|
||||
$("#homeworkSetting").addClass("undis");
|
||||
$("#homeworkSetting").html("");
|
||||
}else if(type == "2"){
|
||||
$("#homeworkSetting").removeClass("undis");
|
||||
$("#homeworkSetting").html("<%=escape_javascript(render :partial => 'users/user_programing_attr', :locals => {:edit_mode => edit_mode, :homework=>homework, :not_allow_select => not_allow_select}) %>");
|
||||
}else if(type == "3"){
|
||||
$("#homeworkSetting").removeClass("undis");
|
||||
$("#homeworkSetting").html("<%=escape_javascript(render :partial => 'users/user_group_attr', :locals => {:edit_mode => edit_mode, :homework=>homework, :not_allow_select => not_allow_select}) %>");
|
||||
if(type == "0"){
|
||||
$('#select_type_nitice').show();
|
||||
}else{
|
||||
$('#select_type_nitice').hide();
|
||||
if(type == "1"){
|
||||
$("#homeworkSetting").addClass("undis");
|
||||
$("#homeworkSetting").html("");
|
||||
}else if(type == "2"){
|
||||
$("#homeworkSetting").removeClass("undis");
|
||||
$("#homeworkSetting").html("<%=escape_javascript(render :partial => 'users/user_programing_attr', :locals => {:edit_mode => edit_mode, :homework=>homework, :not_allow_select => not_allow_select}) %>");
|
||||
}else if(type == "3"){
|
||||
$("#homeworkSetting").removeClass("undis");
|
||||
$("#homeworkSetting").html("<%=escape_javascript(render :partial => 'users/user_group_attr', :locals => {:edit_mode => edit_mode, :homework=>homework, :not_allow_select => not_allow_select}) %>");
|
||||
}
|
||||
}
|
||||
});
|
||||
if($.trim($("#anonymous_comment").val()) == 1) {
|
||||
|
@ -69,7 +75,10 @@
|
|||
}
|
||||
var is_checked = false;
|
||||
checked_val();
|
||||
if(!regex_homework_name()){
|
||||
if($("#homework_type_option").children('option:selected').val() == '0'){
|
||||
$("#select_type_nitice").show();
|
||||
}
|
||||
else if(!regex_homework_name()){
|
||||
$("#homework_name").focus();
|
||||
}
|
||||
else if(!regex_homework_end_time()){
|
||||
|
@ -176,51 +185,56 @@
|
|||
<div class="HomeWorkCon">
|
||||
<a id="submit_homework"></a>
|
||||
<div>
|
||||
<input type="text" name="homework_common[name]" id="homework_name" class="InputBox fl <%= edit_mode ? 'w701' : 'w603' %>" maxlength="255" onfocus="$('#homework_editor').show()" onkeyup="regex_homework_name();" placeholder="发布作业,请先输入作业标题" value="<%= homework.name%>" >
|
||||
<%= link_to("从题库选用", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fr",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%>
|
||||
<% unless edit_mode %>
|
||||
<input type="hidden" name="quotes" id="ref_homework_id" value=""/>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<p id="homework_name_span" class="c_red mt5"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="mt10">
|
||||
<% group_pro = homework.homework_type == 3 && homework.student_work_projects.count != 0 %>
|
||||
<select class="homework-type-option fl mr10" name="homework_type" <%=(not_allow_select || group_pro) ? 'disabled' : '' %> id="homework_type_option">
|
||||
<%= options_for_select(homework_type_option,homework.homework_type) %>
|
||||
<%= options_for_select(homework_type_option,edit_mode ? homework.homework_type : 0) %>
|
||||
</select>
|
||||
<% if not_allow_select || group_pro %>
|
||||
<input type="text" style="display: none" name="homework_type" value="<%=homework.homework_type %>"/>
|
||||
<% end %>
|
||||
<label class="fl c_grey f14 mt5">截止日期:</label>
|
||||
<div class="calendar_div fl mr10">
|
||||
<input type="text" name="homework_common[end_time]" id="homework_end_time" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
|
||||
<% if homework.homework_detail_manual.comment_status.to_i < 2 %>
|
||||
<%= calendar_for('homework_end_time')%>
|
||||
<% end %>
|
||||
</div>
|
||||
<label class="fl c_grey f14 mt5" style="margin-top: 4px;">发布日期(可选):</label>
|
||||
<div class="calendar_div fl">
|
||||
<% allow_edit = homework.student_works.has_committed.count == 0 && homework.student_work_projects.count ==0 %>
|
||||
<input title="<%=allow_edit ? '' : '已有学生提交作品或关联项目,发布日期不可再编辑' %>" type="text" name="homework_common[publish_time]" id="homework_publish_time" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.publish_time%>" >
|
||||
<% if allow_edit %>
|
||||
<%= calendar_for('homework_publish_time')%>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
|
||||
<div class="fr f14 ml10" style="margin-top: 4px;">
|
||||
<input type="checkbox" name="homework_common[anonymous_comment]" value="<%=edit_mode ? homework.anonymous_comment : 1 %>" id="anonymous_comment"/>
|
||||
<span class="f14 c_grey">启用匿评</span>
|
||||
<!--<span id="anonymous_hint" style="display: none; font-size: 12px;" class="c_red">更改后评分比例将恢复默认值</span>-->
|
||||
</div>
|
||||
<% end %>
|
||||
<span class="c_red fl ml10 mt5 <%= edit_mode ? 'none' : '' %>" id="select_type_nitice">发布作业,请先选择作业类型</span>
|
||||
<%= link_to("从题库选用", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fr",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<p id="homework_end_time_span" class="c_red mt5"></p>
|
||||
<div class="cl"></div>
|
||||
<div id="homework_editor" style="display: <%= edit_mode ? 'block':'none'%>">
|
||||
|
||||
<div id="homework_editor" class="mt10" style="display: <%= edit_mode ? 'block':'none'%>">
|
||||
<div>
|
||||
<input type="text" name="homework_common[name]" id="homework_name" class="InputBox fl w701" maxlength="255" onkeyup="regex_homework_name();" placeholder="发布作业,请先输入作业标题" value="<%= homework.name%>" >
|
||||
<% unless edit_mode %>
|
||||
<input type="hidden" name="quotes" id="ref_homework_id" value=""/>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<p id="homework_name_span" class="c_red mt5"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="mt10">
|
||||
<label class="fl c_grey f14 mt5">截止日期:</label>
|
||||
<div class="calendar_div fl mr70">
|
||||
<input type="text" name="homework_common[end_time]" id="homework_end_time" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
|
||||
<% if homework.homework_detail_manual.comment_status.to_i < 2 %>
|
||||
<%= calendar_for('homework_end_time')%>
|
||||
<% end %>
|
||||
</div>
|
||||
<label class="fl c_grey f14 mt5" style="margin-top: 4px;">发布日期(可选):</label>
|
||||
<div class="calendar_div fl">
|
||||
<% allow_edit = homework.student_works.has_committed.count == 0 && homework.student_work_projects.count ==0 %>
|
||||
<input title="<%=allow_edit ? '' : '已有学生提交作品或关联项目,发布日期不可再编辑' %>" type="text" name="homework_common[publish_time]" id="homework_publish_time" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.publish_time%>" >
|
||||
<% if allow_edit %>
|
||||
<%= calendar_for('homework_publish_time')%>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
|
||||
<div class="fr f14 ml10" style="margin-top: 4px;">
|
||||
<input type="checkbox" name="homework_common[anonymous_comment]" value="<%=edit_mode ? homework.anonymous_comment : 1 %>" id="anonymous_comment"/>
|
||||
<span class="f14 c_grey">启用匿评</span>
|
||||
<!--<span id="anonymous_hint" style="display: none; font-size: 12px;" class="c_red">更改后评分比例将恢复默认值</span>-->
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<p id="homework_end_time_span" class="c_red mt5"></p>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10">
|
||||
<% if edit_mode %>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='homework_textarea' name="homework_common[description]"><%=homework.description %></textarea>
|
||||
|
@ -257,7 +271,7 @@
|
|||
<span class="fr mr10 mt3">或</span>
|
||||
<%#= link_to "取消",user_homeworks_user_path(User.current.id),:class => "fr mr10 mt3"%>
|
||||
<a href="javascript:void(0);" id="new_message_cancel_btn" class="fr mr10 mt3">取消</a>
|
||||
<% else %>
|
||||
<% else %>
|
||||
<a href="javascript:void(0);" id="new_message_submit_btn" class="BlueCirBtnMini fr">发送</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<a href="javascript:void(0);" id="new_message_cancel_btn" class="fr mr10 mt3">取消</a>
|
||||
|
|
|
@ -16,5 +16,6 @@ homework_description_editor.html("<%= escape_javascript(@homework.description.ht
|
|||
$("#homeworkSetting").removeClass("undis");
|
||||
$("#homeworkSetting").html("<%=escape_javascript(render :partial => 'users/user_group_attr', :locals => {:edit_mode => true, :homework=>@homework, :not_allow_select => false}) %>");
|
||||
<% end %>
|
||||
$("#homework_type_option option[value='<%=@homework.homework_type %>']").attr("selected",true);
|
||||
document.getElementById("homework_type_option").options[<%=@homework.homework_type %>].selected = true;
|
||||
$("#select_type_nitice").hide();
|
||||
$("#homework_editor").show();
|
||||
|
|
Loading…
Reference in New Issue