项目列表

This commit is contained in:
huang 2016-08-13 11:13:11 +08:00
parent 1b19d227f9
commit 37df983009
4 changed files with 89 additions and 1 deletions

View File

@ -3432,6 +3432,8 @@ class UsersController < ApplicationController
#@projects = @user.projects.visible.order("#{sort_name} #{sort_type}")
@projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS #{sort_name} ").order("#{sort_name} #{sort_type}")
@my_joined_projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS #{sort_name} where user_id != #{@user.id}").order("#{sort_name} #{sort_type}")
@my_projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS #{sort_name} where user_id = #{@user.id}").order("#{sort_name} #{sort_type}")
#根据 问题+资源数排序 @project.project_score.issue_num @project.project_score.attach_num
if @order.to_i == 2

View File

@ -0,0 +1,38 @@
<div class="syllabus_box">
<div class="syllabus_category">
<a class="sortdownbtn sort_no fr"></a><a href="#" class="sortTxt fr">人气</a>
<a class="sortupbtn fr"></a><a href="#" class="sortTxt fr ">时间</a>
<span class="grayTxt fl ">我参与的项目</span>
<div class="cl"></div>
</div>
<div class="syllabus_courses_box">
<% @projects.each do |project| %>
<div class="syllabus_courses_list" style="cursor: default;">
<div class="sy_courses_open">
<span class="icons_project_list fl mt5 mr10"></span>
<h3><%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "new_project_title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%></h3>
<% unless project.is_public? %>
<span class="hw_icon_private fl"></span>
<% end %>
<% 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.updated_on) %></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, file_project_path(project), :class => "c_blue" %><span class="mr5">资源</span>
</p>
</div>
</div>
<div class="cl"></div>
</div>
<% end %>
<div class="syllabus_courses_list ">
<p class="new_projectlist_more"><a href="javascript:void(0);" >共100个项目点击全部展开</a></p>
</div>
</div><!--syllabus_courses_box end-->
</div><!--syllabus_box end-->

View File

@ -0,0 +1,37 @@
<div class="syllabus_category">
<a class="sortdownbtn sort_no fr"></a><a href="#" class="sortTxt fr">人气</a>
<a class="sortupbtn fr"></a><a href="#" class="sortTxt fr ">时间</a>
<span class="grayTxt fl ">我创建的项目</span>
<div class="cl"></div>
</div>
<div class="syllabus_courses_box">
<% @projects.each do |project|%>
<div class="syllabus_courses_list" style="cursor: default">
<div class="sy_courses_open">
<span class="icons_project_list fl mt5 mr10"></span>
<h3><%= link_to "#{project.name}", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "new_project_title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%></h3>
<% unless project.is_public? %>
<span class="hw_icon_private fl"></span>
<% end %>
<% 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.updated_on) %></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, file_project_path(project), :class => "c_blue" %><span class="mr5">资源</span>
</p>
</div>
</div>
<div class="cl"></div>
</div>
<% end %>
<div class="syllabus_courses_list ">
<p class="new_projectlist_more"><a href="javascript:void(0);" >共100个项目点击全部展开</a></p>
</div>
</div><!--syllabus_courses_box end-->

View File

@ -1 +1,12 @@
<%= render :partial => 'users/user_project_list'%>
<div class="syllabus_box">
<h2 class="syllabus_h2_top"><span class="icon_course fl mt7 mr5"></span>项目列表</h2>
<div id="user_syllabus_list">
<%= render :partial => 'users/my_projects'%>
</div>
<div class="" style="height:20px; background:#eaebec;"></div>
<div id="user_join_syllabus_list">
<%= render :partial => 'users/my_joined_projects'%>
</div>
</div>