<ul>
  <li class="fl mt5" style="color:#8b8b8b;">分班:</li>
  <li class="fl sy_fenban_list mr10 mb10 ml10" id="course_group_0">
    <%= link_to l(:label_all), searchgroupmembers_course_path(@course,:group_id => 0), :onclick => "checkclass('course_group_0')", method: 'get', remote: true%>
  </li>
  <li class="fl sy_fenban_list mr10 mb10" id="course_group_1">
    <%= link_to "未分班", searchgroupmembers_course_path(@course,:group_id => -1), :onclick => "checkclass('course_group_0')", method: 'get', remote: true, :class => 'fl mr5'%>
    <span class="fl sy_cgrey">(<%=@no_group_count %>人)</span>
  </li>

  <% unless course_groups.nil? %>
      <% course_groups.each do |group| %>
          <%# group_name = " #{ group.name}( <span class='c_red'>#{group.members.count.to_s}人</span>)".html_safe %>
          <li class="fl sy_fenban_list clear mr10 mb10">
            <%= link_to group.name, searchgroupmembers_course_path(@course,:group_id => group.id), class: 'fl mr5', method: 'get', remote: true,:onclick => "checkclass('group_name_#{group.id}')"%>
            <span class="fl sy_cgrey mr5">(<%=group.members.count.to_s %>人)</span>
            <% if @canShowCode%>
                <a href="javascript:void(0)" class="sy_icons_edit fl" onclick="$('#edit_group_name').val('<%= group.name%>');$('#edit_group_id').val('<%= group.id%>');$('#edit_group_form').slideToggle();"></a>
                <% if group.members.empty?%>
                    <%= link_to '', deletegroup_course_path(:group_id => group.id), :method => 'delete', :remote => true,
                                :data => {confirm: l(:label_delete_group)},
                                :class => 'sy_icons_del fl'
                  %>
                <% else%>
                    <a href="javascript:void(0)" onClick="alert('温馨提示：已有学生加入该班级，不能删除该班级，仅可编辑班级名称。');" class="sy_icons_del fl"></a>
                <% end%>
            <% end %>
          </li>
      <% end %>
      <!-- 编辑分班 -->
      <% if @canShowCode%>
      <li id="edit_group_form" class="fl mr10 mb10 clear undis">
        <%= form_tag(updategroupname_course_path(@course), method: 'get', remote:true, :id => 'update_group_form') do %>
            <input type="hidden" name="group_id" id="edit_group_id"/>
            <input class="fl mr5 sy_fenban_input" id="edit_group_name"name="group_name" size="20" maxlength="20"/>
            <a href="javascript:void(0)" class="sy_btn_blue fl mr5" onclick="edit_group('edit_group_name','<%= valid_ajax_course_path%>','<%= @course.id%>','edit_group_id');">确定</a>
            <a href="javascript:void(0)" class="sy_btn_grey fl" onclick="$('#edit_group_form').hide(); $('#edit_group_id').val(''); $('#edit_group_name').val('');">取消</a>
        <% end %>
      </li>
      <% end %>
  <% end %>
</ul>