2014-12-05 16:03:41 +08:00
|
|
|
<script type=" text/javascript" charset="utf-8">
|
|
|
|
function validate_groupname(value1) {
|
2014-12-04 19:09:10 +08:00
|
|
|
|
2014-12-05 16:03:41 +08:00
|
|
|
if(value1.length > 20) {
|
|
|
|
alert('<%= l(:label_limit_groupname) %>');
|
|
|
|
}
|
|
|
|
}
|
2014-12-06 00:52:06 +08:00
|
|
|
function checkclass(value) {
|
|
|
|
|
|
|
|
for(var i = 0; i < document.getElementsByName("check_group_name").length; i++) {
|
|
|
|
if(document.getElementsByName("check_group_name")[i].id == value) {
|
|
|
|
document.getElementById(value).className = "selected";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
document.getElementsByName("check_group_name")[i].className = "classbox";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2014-12-05 16:03:41 +08:00
|
|
|
function validate_groupname_null(value1) {
|
2014-12-05 17:13:05 +08:00
|
|
|
value1 = value1.trim();
|
|
|
|
if(value1.length == 0 ) {
|
2014-12-05 16:03:41 +08:00
|
|
|
alert('<%= l(:label_limit_groupname_null) %>');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function validate_update(name) {
|
2014-12-05 16:33:55 +08:00
|
|
|
value1 = document.getElementById(name).value;
|
2014-12-05 16:03:41 +08:00
|
|
|
validate_groupname(value1);
|
2014-12-05 16:33:55 +08:00
|
|
|
|
2014-12-05 16:03:41 +08:00
|
|
|
}
|
2014-12-06 00:52:06 +08:00
|
|
|
function validate_add_group() {
|
|
|
|
value1 = document.getElementById('group_name').value;
|
|
|
|
validate_groupname(value1);
|
|
|
|
validate_groupname_null(value1);
|
2014-12-05 16:33:55 +08:00
|
|
|
|
2014-12-06 00:52:06 +08:00
|
|
|
}
|
2014-12-05 16:21:53 +08:00
|
|
|
</script>
|
2014-12-04 19:09:10 +08:00
|
|
|
|
2014-12-03 19:17:10 +08:00
|
|
|
|
|
|
|
<ul>
|
2014-12-06 00:52:06 +08:00
|
|
|
<li class="classbox" id = "group_name_0" name="check_group_name">
|
2014-12-05 23:34:16 +08:00
|
|
|
<% course_member_count = l(:label_all) + " ( " + @membercount.to_s + "人)" %>
|
2014-12-06 00:52:06 +08:00
|
|
|
<%= link_to course_member_count, searchgroupmembers_course_path(@course,:group_id => 0), :onclick => "checkclass('group_name_0')", method: 'get', remote: true,:style => " border:0px; color: #0d90c3; float:left;"%>
|
2014-12-03 19:17:10 +08:00
|
|
|
</li>
|
2014-12-04 19:09:10 +08:00
|
|
|
<% if course_groups.any? %>
|
2014-12-03 19:17:10 +08:00
|
|
|
<% course_groups.each do |group| %>
|
2014-12-06 00:52:06 +08:00
|
|
|
<% group_display = group.name + " ( " + group.members.count.to_s + "人)" %>
|
|
|
|
<li class="classbox" id="group_name_<%= group.id %>" name="check_group_name">
|
|
|
|
<%= link_to group_display, searchgroupmembers_course_path(@course,:group_id => group.id), method: 'get', remote: true,
|
|
|
|
:onclick => "checkclass('group_name_#{group.id}')",:style => " border:0px; color: #0d90c3; float:left;"%>
|
2014-12-05 23:34:16 +08:00
|
|
|
<% if @canShowCode %>
|
|
|
|
<a href="javascript:void(0)" class="f_l" onclick="$('#add_tag_<%= group.id %>').slideToggle();"><img src="/images/pic_edit.png" width="14" height="15" alt="编辑班级" /></a>
|
2014-12-03 19:17:10 +08:00
|
|
|
<% end %>
|
2014-12-05 23:34:16 +08:00
|
|
|
</li>
|
2014-12-03 19:17:10 +08:00
|
|
|
<li>
|
2014-12-04 19:09:10 +08:00
|
|
|
<%= form_tag(updategroupname_course_path(@course,:group_id => group.id), method: 'get', remote:true, update: 'group_name') do %>
|
2014-12-03 19:17:10 +08:00
|
|
|
<span id="add_tag_<%= group.id %>" style="display:none; vertical-align: middle;" class=" f_l">
|
2014-12-05 16:33:55 +08:00
|
|
|
<%= text_field_tag "group_name#{group.id}", params[:group_name],:name => "group_name", :size=>10, :class=>"isTxt w90 f_l", :style=>"padding: 0px", :max => 20 %>
|
2014-12-03 19:17:10 +08:00
|
|
|
<!--<input type="button" class="submit f_l" onclick="addTag();" style="width: 43px"/>-->
|
2014-12-05 16:03:41 +08:00
|
|
|
<%= submit_tag '', class: "submit f_l", :onclick => "validate_update('group_name#{group.id}')", style: "width: 43px;height: 21px;background: url(/images/btn.png) no-repeat 0 0;" %>
|
2014-12-04 19:09:10 +08:00
|
|
|
</span>
|
2014-12-03 19:17:10 +08:00
|
|
|
<% end %>
|
|
|
|
</li>
|
|
|
|
<% end %>
|
2014-12-04 19:09:10 +08:00
|
|
|
<% end %>
|
2014-12-05 10:53:43 +08:00
|
|
|
<% if @canShowCode %>
|
2014-12-03 19:17:10 +08:00
|
|
|
<li style="margin-left:15px;">
|
|
|
|
<a href="javascript:void(0)" class="st_add f_l" onclick="$('#add_tag04').slideToggle();">+添加分班</a>
|
|
|
|
</li>
|
|
|
|
<li>
|
2014-12-04 19:09:10 +08:00
|
|
|
<span id="add_tag04" style="display:none; vertical-align: middle;" class="ml10 f_l">
|
2014-12-05 10:53:43 +08:00
|
|
|
<%= form_tag( addgroups_course_path(@course), method: 'get',:remote=>true) do %>
|
2014-12-04 19:09:10 +08:00
|
|
|
|
|
|
|
<%= text_field_tag "group_name", params[:group_name], size: "20", class: "isTxt w90 f_l", style: "padding: 0px", maxlength: "100" %>
|
2014-12-05 16:03:41 +08:00
|
|
|
<%= submit_tag '', class: "submit f_l",:onclick => "validate_add_group()", style: "width: 43px;height: 21px;background: url(/images/btn.png) no-repeat 0 0;" %>
|
2014-12-04 19:09:10 +08:00
|
|
|
<%= link_to_function '', "$('#add_tag04').slideToggle();", class: "submit_2", style: "width: 43px"%>
|
2014-12-03 19:17:10 +08:00
|
|
|
|
2014-12-04 19:09:10 +08:00
|
|
|
<% end %>
|
|
|
|
</span>
|
|
|
|
</li>
|
2014-12-05 10:53:43 +08:00
|
|
|
<% end %>
|
2014-12-03 19:17:10 +08:00
|
|
|
</ul>
|
2014-12-04 22:02:10 +08:00
|
|
|
|
|
|
|
|
2014-12-03 19:17:10 +08:00
|
|
|
|