From 37df98300932c35b0ac323ff74857b0fcf2b08c7 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 13 Aug 2016 11:13:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 ++ app/views/users/_my_joined_projects.html.erb | 38 ++++++++++++++++++++ app/views/users/_my_projects.html.erb | 37 +++++++++++++++++++ app/views/users/user_projectlist.html.erb | 13 ++++++- 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 app/views/users/_my_joined_projects.html.erb create mode 100644 app/views/users/_my_projects.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 35bd93678..73dfabb08 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/views/users/_my_joined_projects.html.erb b/app/views/users/_my_joined_projects.html.erb new file mode 100644 index 000000000..8a940d9a7 --- /dev/null +++ b/app/views/users/_my_joined_projects.html.erb @@ -0,0 +1,38 @@ +
+
+ 人气 + 时间 + 我参与的项目 +
+
+
+ <% @projects.each do |project| %> +
+
+ +

<%= 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%>

+ <% unless project.is_public? %> + + <% end %> + <% projectUser = User.where("id=?",project.user_id).first %> + <%=link_to "创建者:#{projectUser.try(:realname) != " " ? projectUser.lastname + projectUser.firstname : projectUser.try(:login)}".html_safe, user_path(projectUser) %> +
+
+
+

更新时间:<%= format_date(project.updated_on) %>

+
+

+ <%= link_to project.members.count, member_project_path(project), :class => "c_blue" %>成员  | + <%= link_to project.project_score.issue_num, project_issues_path(project), :class => "c_blue" %>问题  | + <%= link_to project.project_score.attach_num, file_project_path(project), :class => "c_blue" %>资源 +

+
+
+
+
+ <% end %> + +
+
\ No newline at end of file diff --git a/app/views/users/_my_projects.html.erb b/app/views/users/_my_projects.html.erb new file mode 100644 index 000000000..365830611 --- /dev/null +++ b/app/views/users/_my_projects.html.erb @@ -0,0 +1,37 @@ +
+ 人气 + 时间 + 我创建的项目 +
+
+
+ <% @projects.each do |project|%> +
+
+ +

<%= 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%>

+ <% unless project.is_public? %> + + <% end %> + <% projectUser = User.where("id=?",project.user_id).first %> + <%=link_to "创建者:#{projectUser.try(:realname) != " " ? projectUser.lastname + projectUser.firstname : projectUser.try(:login)}".html_safe, user_path(projectUser) %> +
+
+
+

更新时间:<%= format_date(project.updated_on) %>

+
+

+ <%= link_to project.members.count, member_project_path(project), :class => "c_blue" %>成员  | + <%= link_to project.project_score.issue_num, project_issues_path(project), :class => "c_blue" %>问题  | + <%= link_to project.project_score.attach_num, file_project_path(project), :class => "c_blue" %>资源 +

+
+
+
+
+ <% end %> + + +
\ No newline at end of file diff --git a/app/views/users/user_projectlist.html.erb b/app/views/users/user_projectlist.html.erb index fb1b5b501..92f9a9d66 100644 --- a/app/views/users/user_projectlist.html.erb +++ b/app/views/users/user_projectlist.html.erb @@ -1 +1,12 @@ -<%= render :partial => 'users/user_project_list'%> +
+

项目列表

+
+ <%= render :partial => 'users/my_projects'%> +
+ +
+
+ <%= render :partial => 'users/my_joined_projects'%> +
+
+