<div class="top_new">
  <span class="<%= (@user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true)) ? 'top_new_bg' : 'top_newcourses_bg'%> fl"></span>
  <% if @user.allowed_to?(:add_project, nil, :global => true) %>
    <a href="<%= url_for(:controller => 'projects', :action => 'new') %>" class="bgreen_n_btn fr ml10 mt2" target="_blank">新建项目</a>
  <% end %>
  <div class="cl"></div>
</div>

<div id="RSide" class="fl">
  <div class="courses_box">
    <div class="courses_top mb10">
      <h2 class="courses_h2 fl">全部项目</h2>
      <div class="courses_select fr">
        <a href="<%= url_for(:controller => 'users', :action => 'user_projects')%>" class="select_btn <%= (@params!='1' && @params!='2') ? 'select_btn_select' : '' %> fl ">
          全部
        </a>
        <a href="<%= url_for(:controller => 'users', :action => 'user_projects', :status=>'1')%>" class="select_btn <%= (@params=='1') ? 'select_btn_select' : '' %> fl ">

          <%= User.current == @user ? "我创建" : "TA创建"%>
        </a>
        <a href="<%= url_for(:controller => 'users', :action => 'user_projects', :status=>'2')%>" class="select_btn <%= (@params=='2') ? 'select_btn_select' : '' %> fl ">
          <%= User.current == @user ? "我参与" : "TA参与"%>
        </a>
      </div>
      <div class="cl"></div>
    </div>
    <% for item in @list %>
    <% creator = User.find(item.user_id)%>
    <div class="courses_list line">
      <div class="courses_list_pic fl"><a href="<%= url_for(:controller => 'projects', :action=>"show", :id=>item.id, :host=>Setting.host_name) %>"><%= image_tag(url_to_avatar(item), :style => 'width:64px;height:64px;') %></a></div>
      <div class="courses_list_info fl ml10">
        <a href="<%= url_for(:controller => 'projects', :action=>"show", :id=>item.id, :host=>Setting.host_name) %>" class="courses_list_title  f14 fb c_blue02 fl" title="<%= item.name %>"><%= item.name %></a>
        <div class="cl"></div>
        <div class="courses_list_table ">
          <table>
            <tbody><tr>
              <td class="td_w60 ">创建者：</td>
              <td class="td_w70 "><a href="<%= user_path(creator) %>" title="<%= creator.show_name %>"><%= creator.show_name %></a></td>
              <td class="td_w60 ">创建时间：</td>
              <td class="td_w110 "><%= format_date(item.created_on) %></td>
            </tr>
            <tr>
              <td>成员人数：</td>
              <td><a href="<%= url_for(:controller => 'projects', :action=>"member", :id=>item.id, :host=>Setting.host_name) %>"><%= item.members.count %></a></td>
              <td>项目类型：</td>
              <td><%= item.project_new_type == 1 ? l(:label_development_team) : (item.project_new_type == 2 ? l(:label_research_group) : l(:label_friend_organization))%></td>
            </tr>
            </tbody></table>
        </div>
      </div>
      <% if User.current.member_of? item%>
          <a href="<%= url_for(:controller => 'issues', :action=>"new", :project_id=>item.id, :host=>Setting.host_name) %>" target="_blank" class="blue_n_btn fr mt20">发布问题</a>
      <% elsif User.current.logged?%>
          <% if item.applied_projects.find_by_user_id(User.current.id)%>
              <%= link_to '取消申请',appliedproject_applied_path(:project_id => item.id,:user_id => User.current.id),:class => "blue_n_btn fr mt20", :remote => "true",:method => "delete",:id => "applied_project_link_#{item.id}"%>
          <% else%>
              <%= link_to "加入项目",appliedproject_path(:user_id => User.current.id,:project_id => item.id,:project_join => true),:class => "blue_n_btn fr mt20", :remote => "true",:method => "post",:id => "applied_project_link_#{item.id}" %>
          <% end%>

      <% end%>
      <div class="cl"></div>
    </div>
    <% end %>
    <p class="nodata" style="display:<%= @list.count > 0 ? 'none' : 'block' %>;"><%= l(:label_no_data) %></p>
  </div>
  <ul class="wlist" style=" border:none;">
    <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
  </ul>
  <div class="cl"></div>
</div>