From 1e6693cdcfafd72048e635ecfa2e7a6474cc2249 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 4 Jul 2014 11:26:37 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=8F=96=E6=B6=88=E8=BD=AF=E4=BB=B6=E5=88=9B?= =?UTF-8?q?=E5=AE=A2=E7=95=8C=E9=9D=A22=E4=B8=AA=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E5=BE=97=E5=88=86=E6=98=BE=E7=A4=BA=202.=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=BD=AF=E4=BB=B6=E5=88=9B=E5=AE=A2=E7=95=8C=E9=9D=A2=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=8F=82=E4=B8=8E=E8=AF=BE=E7=A8=8B=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84BUG=203.=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7=E5=8F=82=E4=B8=8E=E7=9A=84?= =?UTF-8?q?=E6=9C=AA=E8=BF=87=E6=9C=9F=E7=9A=84=E9=A1=B9=E7=9B=AE=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/users_helper.rb | 11 +++++++++++ app/views/users/_user_show.html.erb | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 87b495f0..e65fe174 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -247,4 +247,15 @@ module UsersHelper displayed_flag = %w|index| !displayed_flag.include?(params['action']) end + + #获取指定用户的未过期的课程列表 + def user_courses_list user + result = [] + user.coursememberships.map(&:course).each do |course| + if !course_endTime_timeout?(course) + result << course + end + end + return result + end end diff --git a/app/views/users/_user_show.html.erb b/app/views/users/_user_show.html.erb index bf97ad29..0873f271 100644 --- a/app/views/users/_user_show.html.erb +++ b/app/views/users/_user_show.html.erb @@ -39,7 +39,7 @@
- <% unless user.memberships.empty? %> - <% cond = Project.visible_condition(User.current) + " AND projects.project_type = 1" %> - <% memberships = user.memberships.all(:conditions => cond) %> - <%= l(:label_x_course_contribute_to, :count => memberships.count) %> - <% for member in memberships %> - <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %> - <% end %> + <%# unless user.memberships.empty? %> + <%# cond = Project.visible_condition(User.current) + " AND projects.project_type = 1" %> + <%# memberships = user.memberships.all(:conditions => cond) %> + <% user_courses = user.coursememberships.map(&:course) %> + <%= l(:label_x_course_contribute_to, :count => user_courses.count) %> + <% for course in user_courses %> + <%# if course.name != nil %> + <%= link_to course.name,course_path(course) %><%= (user_courses.last == course) ? '' : ',' %> + <%# end %> <% end %> + <%# end %>
<%= user.changesets.count == 0 ? '' : "#{l(:label_x_total_commit, :count => user.changesets.count)}" %>