<div class="syllabus_category">
  <% unless projects.empty? %>
      <% if @type.to_i  == 2 %>
          <%= link_to "", {:controller => 'users', :action => 'sort_project_list', :id => @user,:list_type => list_type, :type => @type,  :sort => @c_sort, :order => 2 },
                      :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :style => "margin-right: 5px;", :remote => true %>
      <% else %>
          <%= link_to "", {:controller => 'users', :action => 'sort_project_list', :id => @user,:list_type => list_type, :type => @type,  :sort => @c_sort, :order => 2 },
                      :class => "sortdownbtn  sort_no fr", :style => "margin-right: 5px;", :remote => true %>
      <% end %>
      <%= link_to "人气", {:controller => 'users', :action => 'sort_project_list', :id => @user,:list_type => list_type, :type => @type,  :sort => @c_sort, :order => 2 },
                  :class => "sortTxt fr", :remote => true %>
      <% if @type.to_i == 1 %>
          <%= link_to "", {:controller => 'users', :action => 'sort_project_list', :id => @user,:list_type => list_type, :type => @type,  :sort => @c_sort, :order => 1 },
                      :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :remote => true %>
      <% else %>
          <%= link_to "", {:controller => 'users', :action => 'sort_project_list', :id => @user,:list_type => list_type, :type => @type,  :sort => @c_sort, :order => 1 },
                      :class => "sortdownbtn  sort_no fr", :remote => true %>
      <% end %>
      <%= link_to "时间", {:controller => 'users', :action => 'sort_project_list', :id => @user,:list_type => list_type, :type => @type,  :sort => @c_sort, :order => 1 },
                  :class => "sortTxt fr", :remote => true %>
  <% end %>
<span class="grayTxt fl "><%= @user == User.current ? "我" : "他" %><%= list_type == 1 ? "创建" : "参与"%>的项目</span>
<div class="cl"></div>
</div>
<div class="syllabus_courses_box" id="project_li_<%=list_type %>">
<% if projects.empty? %>
      <div class="icons_tishi"><img src="/images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
      <% if list_type == 1 %>
        <p class="sy_tab_con_p"><%=@user == User.current ? "您" : "他" %>还没有创建项目~~<br />
          <%= link_to "创建项目",  new_project_path(:host => Setting.host_name), :target => "_blank", :class => "sy_btn_green ml5 mt5" if @user == User.current %>
        </p>
      <% else %>
          <p class="sy_tab_con_p"><%=@user == User.current ? "您" : "他" %>还没有加入项目~~<br />
            <%= link_to "加入项目", applied_join_project_path, :remote => true, :method => "post", :class => "sy_btn_green ml5 mt5" if @user == User.current %>
          </p>
      <% end %>
<% else %>
  <% projects.each_with_index do |project, i| %>
    <div class="syllabus_courses_list <%= i > 4 ? 'none' : ''%>" style="cursor: default;">
      <% allow_visit = User.current.member_of?(project) || User.current.admin? || project.is_public? %>
      <div class="sy_courses_open">
        <span id="collect_project_icon_<%= project.id %>">
            <%=render :partial => 'collect_project', :locals => {:project => project} %>
        </span>
        <h3><%= link_to project.name, allow_visit ? project_path(project.id,:host=>Setting.host_name) : 'javascript:void(0)', :target => '_blank',
                        :class => "new_project_title fl",:id => "show_project_#{project.id}", :title => (allow_visit ? "#{project.name}" : "私有项目不可访问") %></h3>
        <%# unless project.is_public? %>
        <!--    <span class="syllabus_class_private fl ml10 mt3 syllabus_class_property">私有</span> -->
        <%# end %>
        <span class="<%= project.is_public? ? 'syllabus_class_open' : 'syllabus_class_private' %> fl ml10 mt3 syllabus_class_property"><%= project.is_public?  ? '公开' : '私有' %></span>
        <% projectUser = User.where("id=?",project.user_id).first %>
        <%= link_to "<span class='fr grayTxt'>创建者：#{projectUser.try(:realname) != " " ? projectUser.lastname + projectUser.firstname : projectUser.try(:login)}</span>".html_safe, user_path(projectUser) %>
        <div class="cl"></div>
      </div>
      <div>
        <p class="fl sy_p_grey">更新时间：<%= format_date(project.updatetime) %></p>
        <div class=" fr">
          <p class="list-info fr grayTxt">
            <%= link_to project.members.count, member_project_path(project), :class => "c_blue" %><span class="mr5">成员&nbsp;&nbsp;|</span>
            <%= link_to project.project_score.issue_num, project_issues_path(project), :class => "c_blue" %><span class="mr5">问题&nbsp;&nbsp;|</span>
            <%= link_to project.project_score.attach_num, project_files_path(project), :class => "c_blue" %><span class="mr5">资源</span>
          </p>
        </div>
      </div>
      <div class="cl"></div>
    </div>
  <% end %>
    <% if count > 5 %>
        <div class="syllabus_courses_list">
          <p class="new_projectlist_more"><a id="project_more_<%=list_type %>" href="javascript:void(0);" data-count="<%= count %>" data-init="0" onclick="expand_projects('#project_more_<%=list_type %>',
                  '#project_li_<%=list_type %>', <%=count%>);">共<%=count %>个项目，点击全部展开</a></p>
        </div>
    <% end %>
<% end %>
</div><!--syllabus_courses_box end-->