<% projects.each do |project|%>
    <li>
      <span class="user_icons_class"></span>
      <% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count %>
      <%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "project_list_menu hidden",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目：":"私有项目：") + project.name%>

      <div class="user_navmore_box">
        <ul class="<%#= count > 0 ? 'shild shildP':'subNavArrow'%>">
          <li class="user_navmore_icons">
            <ul class="user_navmore_txt">
              <li class="clear">
                <%=link_to "问题跟踪", project_issues_path(project), :class => 'user_navmore_li fl', :target => '_blank' %>
                <%=link_to "+", new_project_issue_path(project), :class => 'user_navmore_add fl', :target => '_blank', :title => '发布问题' %>
              </li>
              <li class="clear">
                <%=link_to "资源", project_files_path(project),:class => 'user_navmore_li fl' %>
                <%=link_to "+", upload_files_menu_path(:project_id => project.id),:remote => true,:class => 'user_navmore_add fl',:title => '上传资源'%>
              </li>
              <li class="clear">
                <%=link_to "论坛", project_boards_path(project),:class => 'user_navmore_li fl', :target => '_blank'%>
                <%=link_to "+", project_boards_path(project, :flag => true),:class => 'user_navmore_add fl', :target => '_blank',:title => '发布帖子'%>
              </li>
              <% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, project)) && rep_is_gitlab?(project) %>
                  <li>
                    <%= link_to '版本库', url_for(:controller => 'projects', :action => 'settings', :id => project.id, :tab=>'repositories') , :target => '_blank',:class => "user_navmore_li",:title => '版本库' %>
                    <div class="cl"></div>
                  </li>
              <% end %>
              <% if User.current == @user %>
                  <li>
                    <%= link_to "取消收藏", cancel_or_collect_user_path(user, :project => project.id), :class => 'user_navmore_li',:target => '_blank', :remote => true %>
                    <div class="cl"></div>
                  </li>
                  <li>
                    <% if ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count == 0 %>
                        <%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :project_id => project.id), :method => 'post',:remote => true,:class => "user_navmore_li" %>
                    <% else %>
                        <%= link_to "显示动态", show_acts_shield_activities_path(:user_id => user.id, :project_id => project.id),:method => 'delete',:remote => true,:class => "user_navmore_li" %>
                    <% end %>
                    <div class="cl"></div>
                  </li>
                  <li>
                    <% if ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count == 0 %>
                        <%= link_to "屏蔽微信消息", shield_wechat_messages_path(:user_id => user.id, :project_id => project.id), :method => 'post',:remote => true,:class => "user_navmore_li" %>
                    <% else %>
                        <%= link_to "接收微信消息", show_messages_shield_wechat_messages_path(:user_id => user.id, :project_id => project.id),:method => 'delete',:remote => true,:class => "user_navmore_li" %>
                    <% end %>
                    <div class="cl"></div>
                  </li>
              <% end %>
              <% if  User.current.logged? && (User.current.admin? || is_project_manager?(User.current,project))  %>
                  <li>
                    <%= link_to project.is_public? ? "设为私有" : "设为公开", {:controller => 'projects', :action => 'set_public_or_private', :id => project.id,:user_page => true},
                                :id => 'set_project_public_'+ project.id.to_s,:method => 'post',:remote=>true,:confirm=>"您确定要设置为"+(project.is_public? ? "私有" : "公开")+"吗",:class => "user_navmore_li"%>
                    <div class="cl"></div>
                  </li>
              <% end %>
            </ul>
          </li>
        </ul>
      </div>
    </li>
<% end %>

<% if all_count > (page.to_i+1) * 10%>
    <a class="user_navmorebox" href="javascript:void(0);" id="user_show_more_project" onclick="show_more_project('<%= user_projects4show_user_path(user.id,:page => page)%>');">
      <span class="user_icons_moreclass"></span>
    </a>
<% end%>

<script type="text/javascript">
    var projectcount = <%= all_count %>;
    var projectshowcount = document.getElementsByClassName("project_list_menu").length;

    if((projectcount <= projectshowcount)&&(projectcount > 10)){
        $("#user_show_more_project").hide();
        $('#user_hide_project').show();
    }
</script>
