<div class="clear mb10">
  <% if @canShowCode %>
      <a href="javascript:void(0)" class="sy_btn_green fl mr10" onclick="$('#group_name').value='';$('#new_group_name').slideToggle();">添加分班</a>
      <div class="fl" id="new_group_name" style="display:none; vertical-align: middle;">
        <%= form_tag( addgroups_course_path(@course),  method: 'get',:remote=>true,:id => 'add_group_name') do %>
            <input type="text" id="group_name" name="group_name" size="20" class="fl mr5 sy_fenban_input" placeholder="例如：A班" maxlength="20" />
            <a href="javascript:void(0)" class="sy_btn_blue fl mr5" onclick="add_group('<%= valid_ajax_course_path%>','<%= @course.id%>');">确定</a>
            <a href="javascript:void(0)" class="sy_btn_grey fl" onclick="$('#group_name').value='';$('#new_group_name').slideToggle();">取消</a>
        <% end %>
      </div>
  <% end %>
  <div class="hw_search_box fr">
    <%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:remote=>true,:id => "search_student") do %>
        <input class="hw_search-input" name="name" id="search_member_input" placeholder="输入学生登录名/姓名/学号进行搜索" type="text">
        <% if @group %>
            <%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group == -1 ? -1 : @group.id}", name: 'search_group_id' %>
            <input type="hidden" name="ingroup">
        <% else %>
            <input type="hidden" name="incourse">
        <% end %>
    <% end %>
    <a href="javascript:void(0)" class="hw_btn_search" onclick="$('#search_student').submit();"></a>
  </div>
</div>

<script>
    $(function(){
        $("#search_member_input").keypress(function(e){
            var name = $.trim($('#search_member_input').val());
            if (e.keyCode == '13' && name != "" &&  name.length != 0) {
                $(this).parent().submit();
            }
        })
    });
</script>