socialforge/app/views/users/_user_group_attr.html.erb

49 lines
2.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div id="groupHomework">
<div> <span class="f14 mt5 fl fontGrey3 mr10">分组设置:</span>
<div class="mr50 fl"> <span class="f14 fontGrey3 mr5">每组最小人数:</span>
<input id="min_num" type="text" name="min_num" class="markInput" value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.min_num : 2 %>" <%=(not_allow_select && homework.is_group_homework?) ? "onchange = regex_scope(#{homework.homework_detail_group.min_num}, 1)" : '' %>/>人
</div>
<div class="fl"> <span class="f14 fontGrey3 mr5">每组最大人数:</span>
<input id="max_num" type="text" name="max_num" class="markInput" value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.max_num : 10 %>" <%=(not_allow_select && homework.is_group_homework?) ? "onchange = regex_scope(#{homework.homework_detail_group.max_num}, 2)" : '' %>/>人
</div>
<span class="c_red undis ml20 mt7 fl" id="min_max_num_notice"></span>
<div class="cl"></div>
<div class="ml80">
<label>
<input type="checkbox" class="mr5" name="base_on_project" value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.base_on_project : 1 %>" id="base_on_project" <%=not_allow_select ? 'disabled' : '' %>/>
<span class="f14 fontGrey3 mr10">基于项目实施</span>
</label>
<p class="c_red">提醒勾选后各小组必须在Trustie平台创建项目教师可随时观察平台对各小组最新进展的实时统计</p>
</div>
<div class="cl"></div>
</div>
</div>
<div class="cl"></div>
<script>
$(function () {
if($.trim($("#base_on_project").val()) == 1) {
$("#base_on_project").attr('checked','checked');
}
<% if not_allow_select && homework.is_group_homework? %>
$("#min_num").on('change', function() {
var min_num = <%=homework.homework_detail_group.min_num %>;
if(parseInt($(this).val()) > min_num) {
$(this).val(min_num);
$("#min_max_num_notice").html('分组范围不可缩小').show();
} else {
$("#min_max_num_notice").html('').hide();
}
});
$("#max_num").on('change', function() {
var max_num = <%=homework.homework_detail_group.max_num %>;
if(parseInt($(this).val()) < max_num) {
$(this).val(max_num);
$("#min_max_num_notice").html('分组范围不可缩小').show();
} else {
$("#min_max_num_notice").html('').hide();
}
});
<% end %>
});
</script>