<%= stylesheet_link_tag  'pleft','header','new_user','repository','org', 'public' %>
<script>
    $(document).ready(function(){
        $(".resource-switch").click(function(){
            $(".resource-switch").children().removeClass("resource-tab-active");
            $(this).children().addClass("resource-tab-active");
        });
        $("input[name='checkMenu']").click(function(){
            if($("input[name='checkMenu']:checked").length >= 1){
                $(".resourcesSelectSendButton").removeClass("inactive-border");
                $(".resourcesSelectSendButton").mouseover(function(){
                    $(this).css("backgroundColor","#297fb8");
                });
                $(".resourcesSelectSendButton").mouseout(function(){
                    $(this).css("backgroundColor","#fff");
                });
                $(".sendButtonBlue").removeClass("inactive-text");
            }
        });
    });
    function choose_course(user_id) {
        var check = $('input[name="checkMenu"]:checked');
        if(check.length == 0) {
            $("#choose_homework_notice").text("请先选择一个作业");
        } else {
            var hw_id = $('input[name="checkMenu"]:checked').val();
            $("#choose_homework_notice").text("");
            $.ajax({
                type: 'get',
                url: '/users/' + user_id + '/choose_user_course?homework='+hw_id,
                data:{send_id:$('input[name="checkMenu"]:checked').val()}
            });
        }
    }
</script>

<div class="homepageContentContainer">
  <div class="homepageContent">
    <div class="resource-wrapper mb10">
        <ul class="resource-banner">
          <li class="fl resource-switch">
            <a href="<%= user_homework_type_user_path(@user,:is_import => 0) %>" id="public_homeworks_choose" class="resource-tab resource-tab-active" data-remote="true">题库</a>
          </li>
          <li class="fl resource-switch">
            <a href="<%= user_homework_type_user_path(@user,:type=>'2',:is_import => 0) %>" id="user_homeworks_choose" class="resource-tab" data-remote="true">我的题库</a>
          </li>
          <li class="fl resource-switch">
            <a href="<%= user_homework_type_user_path(@user,:type=>'3',:is_import => 0) %>" id="apply_homeworks_choose" class="resource-tab" data-remote="true">申请题库</a>
          </li>
          <li class="fl w680 border-bottom h34">&nbsp;</li>
          <li class="fr resource-banner-li border-bottom h34">
            <ul class="resourcesSelect">
              <li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
                <ul class="resourcesType">
                  <li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0) %>" id="homework_type_all" class="resourcesTypeAll resourcesGrey" data-method="get" data-remote="true">全部</a> </li>
                  <li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 1) %>" id="homework_type_nor" class="homepagePostTypeAssignment postTypeGrey" data-method="get" data-remote="true">普通作业</a> </li>
                  <li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 2) %>" id="homework_type_pro" class="program-btn postTypeGrey" data-method="get" data-remote="true" style="white-space:nowrap;">编程作业</a> </li>
                  <li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 3) %>" id="homework_type_gro" class="group-btn resourcesGrey" data-method="get" data-remote="true">分组作业</a> </li>
                </ul>
              </li>
            </ul>
          </li>
          <div class="cl"></div>
        </ul>
        <div class="cl"></div>
        <div id="homework_search_input" class="mt10 fl">
            <%=render :partial=>'homework_repository_search', :locals=>{:type => @type,:is_import => 0,:property => nil} %>
        </div>
        <div class="cl"></div>
        <div class="w683 fl mr10 mt10" id="homework_repository_list">
          <%=render :partial => 'homework_repository_list', :locals => {:homeworks => @homeworks,:type=>@type,:is_import => 0,:property => @property,:search=>''} %>
        </div>
        <div id="homework_repository_detail">
          <%=render :partial => 'homework_repository_detail', :locals => {:homework => nil} %>
        </div>
        <div class="cl"></div>
        <div>
          <ul class="wlist mt10" id="homework_pository_ref_pages" style="margin-top: 5px;margin-right: 295px">
            <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
          </ul>
        </div>
          <div class="fl resourcesSelectSendButton mr15 inactive-border mt10">
            <a href="javascript:void(0)" onclick="choose_course('<%=User.current.id %>');" class="sendButtonBlue db inactive-text" data-remote="true">发送至</a>
          </div>
          <span class="c_red fl mt15" id="choose_homework_notice"></span>
        </div>
        </div>
  </div>
</div>