发布作业时添加分组作业

This commit is contained in:
cxt 2015-12-02 11:14:46 +08:00
parent 68a29d8131
commit ae218fa86c
7 changed files with 126 additions and 7 deletions

View File

@ -0,0 +1,24 @@
<span class="f16 fontBlue">分组设置</span>
<a href="javascript:void(0);" class="popClose" title="关闭弹框"></a>
<div class="mt10">
<span class="f14 fontGrey3 mr5">每组最小人数:</span>
<input id="min_num" type="text" name="" class="markInput" value="2" />人
</div>
<div class="mt10">
<span class="f14 fontGrey3 mr5">每组最大人数:</span>
<input id="max_num" type="text" name="" class="markInput" value="10" />人
</div>
<div class="mb10 mt10">
<label>
<input type="checkbox" class="mr5" name="base_on_project" value="0" id="base_on_project"/>
<span class="f14 fontGrey3 mr10">是否基于项目实施</span>
</label>
<p class="c_red">提醒勾选后各小组必须在Trustie平台创建项目教师可随时观察平台对各小组最新进展的实时统计。</p>
</div>
<div class="courseSendSubmit">
<a href="javascript:void(0);" class="group_btn sendSourceText">确定</a>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" class="sendSourceText linkGrey6" id="cancel_group">取消</a>
</div>
<div class="cl"></div>

View File

@ -43,16 +43,18 @@
:lebel_file_uploding => l(:lebel_file_uploding),
:delete_all_files => l(:text_are_you_sure_all)
} %>
<span class="fl fontGrey2 mt3 group_detail_info"></span>
</div>
<div class="cl"></div>
<div class="mt5 fl">
<!-- , user_import_resource_user_path(User.current.id,:homework_id=>container.id) -->
<a href="javascript:void(0);" class="AnnexBtn fl mt3 mr20" onclick="$('#_file').click();">上传附件</a>
<%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3 mr20",:remote => true%>
<a href="javascript:void(0);" class="AnnexBtn fl mt3 mr15" onclick="$('#_file').click();" title="请选择文件上传">上传附件</a>
<%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3 mr15",:title=>"请从资源库中选择文件作为作品的附件",:remote => true%>
<% if defined?(has_program) && has_program %>
<a href="javascript:void(0);" class="ProBtn fl mt3">编程</a>
<span class="fl C_lgrey mt3 program_detail_info"></span>
<a href="javascript:void(0);" class="ProBtn fl mt3" title="请设置编程语言和输入测试集">编程</a>
<span class="fl C_lgrey mt3 program_detail_info"></span>
<a href="javascript:void(0);" class="groupBtn fl mt3 ml15" title="请设置分组作业的相关参数">分组</a>
<% end %>
</div>

View File

@ -97,7 +97,18 @@
</div>
</script>
<script id="t:group-input-list" type="text/html">
<div class="group-input">
<input type="hidden" name="min_num" value="<!= min_num !>" />
<input type="hidden" name="max_num" value="<!= max_num !>" />
<input type="hidden" name="base_on_project" value="<!= base_on_project !>" />
</div>
</script>
<div class="BluePopupBox" id="BluePopupBox" style="display:none">
<%= render :partial => 'users/user_programing_attr', :locals => {:edit_mode => edit_mode, :homework=>homework} %>
</div><!----BluePopupBox end-->
<div class="BluePopupBox" style="display:none" id="GroupPopupBox">
<%= render :partial => 'users/user_group_attr', :locals => {:edit_mode => edit_mode, :homework=>homework}%>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -124,7 +124,6 @@ $(function(){
$('#textarea_input_test').focus();
});
var saveProgramAnswers = function() {
var test_numbers = 0;
var valid = true;
@ -171,7 +170,7 @@ $(function(){
$("input[name=homework_type]").after(html);
}
return valid;
}
};
$("#BluePopupBox a.BlueCirBtn").live('click', function(){
if(saveProgramAnswers()){
@ -198,6 +197,68 @@ $(function(){
$(this).parent('.mt10').remove();
});
//分组作业
$("#GroupPopupBox").dialog({
modal: true,
autoOpen: false,
dialogClass: 'BluePopupBox',
minWidth: 290
});
$('a.groupBtn').live('click', function(){
$("#GroupPopupBox").dialog("open");
$(".ui-dialog-titlebar").hide();
$("a.popClose").on('click', function(){
$("#GroupPopupBox" ).dialog("close");
});
$("#cancel_group").on('click', function(){
$("#GroupPopupBox" ).dialog("close");
});
$('#min_num').focus();
});
var saveGroupAttr = function() {
var valid = true;
var base_on_project = 0;
var min = $.trim($("#min_num").val());
var max = $.trim($("#max_num").val());
if(min.length <= 0) {
$("#min_num").focus();
valid = false;
return false;
}
if(max.length <= 0) {
$("#max_num").focus();
valid = false;
return false;
}
if ($("#base_on_project").is(":checked")) {
base_on_project = 1;
}
if (valid) {
$("input[name=homework_type]").val(3);
$('span.group_detail_info').text('分组人数:'+min+'-'+max+' 人');
//保存js值
var data = {
base_on_project: base_on_project,
min_num: min,
max_num: max
};
//构建到form中
$('.group-input').remove();
var html=bt('t:group-input-list',data);
$("input[name=homework_type]").after(html);
}
return valid;
};
$("#GroupPopupBox a.group_btn").live('click', function(){
if(saveGroupAttr()){
if($( "#GroupPopupBox" ).dialog( "isOpen" )){
$("#GroupPopupBox").dialog( "close" );
}
}
});
//代码编辑器
if (typeof CodeMirror != "undefined") {

View File

@ -1175,4 +1175,14 @@ a:hover.testEdit{ background:url(images/icons.png) -21px -272px no-repeat;}
.rankList li p {width:100%; overflow:hidden; white-space:normal; text-overflow:ellipsis; color:#585858;word-wrap: normal; word-break: normal;}
.rankPortrait {border-radius:50%; width:35px; height:35px;}
.numIntro {position:absolute; text-align:left; z-index:999; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); border:1px solid #eaeaea; background-color:#ffffff; padding:3px 5px; left:15px; color:#585858; white-space: nowrap;}
.font_cus {font-family: "微软雅黑","宋体"; font-size: 12px; line-height: 1.5;}
.font_cus {font-family: "微软雅黑","宋体"; font-size: 12px; line-height: 1.5;}
/*20151130课程项目集成Tim*/
a.testBtn{background: url(/images/course/hwork_icon.png) -2px -5px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
a:hover.testBtn{background: url(/images/course/hwork_icon.png) -81px -5px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
a.groupBtn{ background: url(/images/course/hwork_icon.png) -2px -61px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
a:hover.groupBtn{background: url(/images/course/hwork_icon.png) -80px -61px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
.markInput { outline:none; border:1px solid #e6e6e6; height:30px; width:50px; color:#3d3c3c; margin-right:5px; text-align:center; padding-left:0px;}
.groupPopUp {width:290px; height:auto; padding:15px; background-color:#ffffff; z-index:1000; position:relative;}
.popClose {background:url(/images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:2px; top:3px;}
a.memberBtn{ background: url(/images/course/hwork_icon.png) -7px -90px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
a:hover.memberBtn{background: url(/images/course/hwork_icon.png) -80px -90px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}

View File

@ -1349,3 +1349,14 @@ span.author { font-size: 0.9em; color: #888; }
.pageCell:hover {border:1px solid #3498db; z-index:10;}
.pageCellActive {background-color:#3498db; border:1px solid #3498db !important; position:relative; color:#ffffff;}
/*20151130课程项目集成Tim*/
a.testBtn{background: url(/images/course/hwork_icon.png) -2px -5px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
a:hover.testBtn{background: url(/images/course/hwork_icon.png) -81px -5px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
a.groupBtn{ background: url(/images/course/hwork_icon.png) -2px -61px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
a:hover.groupBtn{background: url(/images/course/hwork_icon.png) -80px -61px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
.markInput { outline:none; border:1px solid #e6e6e6; height:30px; width:50px; color:#3d3c3c; margin-right:5px; text-align:center; padding-left:0px;}
.groupPopUp {width:290px; height:auto; padding:15px; background-color:#ffffff; z-index:1000; position:relative;}
.popClose {background:url(/images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:2px; top:3px;}
a.memberBtn{ background: url(/images/course/hwork_icon.png) -7px -90px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
a:hover.memberBtn{background: url(/images/course/hwork_icon.png) -80px -90px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}