1.个人主页--关注、粉丝,即使关注者、粉丝没有参加项目、课程,显示为“参与了0个项目/课程” #1211

2 修复个人主页关注、粉丝参与课程列表不正确的BUG
This commit is contained in:
sw 2014-08-29 09:40:57 +08:00
parent 3919d0fd48
commit dcde828e64
2 changed files with 22 additions and 30 deletions

View File

@ -20,27 +20,18 @@
<tr> <tr>
<!-- added by bai 区分了个人列表里的项目与课程 --> <!-- added by bai 区分了个人列表里的项目与课程 -->
<td colspan="2" width="580px"><p class="font_description"> <td colspan="2" width="580px"><p class="font_description">
<% unless user.memberships.empty? %> <% cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" %>
<% cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" %> <% memberships = user.memberships.all(:conditions => cond) %>
<% memberships = user.memberships.all(:conditions => cond) %> <%= l(:label_x_contribute_to, :count => memberships.count) %>
<%= l(:label_x_contribute_to, :count => memberships.count) %> <% for member in memberships %>
<% for member in memberships %> <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %>
<% end %>
<% else %>
<%= l(:label_x_contribute_to, :count => 0) %>
<% end %> <% end %>
<p class="font_description"> <p class="font_description">
<% unless user.memberships.empty? %> <% user_courses = user_courses_list(user) %>
<% cond = Project.visible_condition(User.current) + " AND projects.project_type = 1" %> <%= l(:label_x_course_contribute_to, :count => user_courses.count) %>
<% memberships = user.memberships.all(:conditions => cond) %> <% for course in user_courses %>
<%= l(:label_x_course_contribute_to, :count => memberships.count) %> <%= link_to course.name,{:controller => 'courses',:action => 'show',id:course.id, host: Setting.course_domain} %><%= (user_courses.last == course) ? '' : '' %>
<% for member in memberships %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %>
<% end %>
<% else %>
<%= l(:label_x_course_contribute_to, :count => 0) %>
<% end %> <% end %>
</p> </p>
</td> </td>

View File

@ -7,31 +7,32 @@
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :title => "#{user.name}" %></td> <td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :title => "#{user.name}" %></td>
<td><table width="580px" border="0"> <td><table width="580px" border="0">
<tr> <!-- modified by bai 增加了关注人的名字全称--> <tr> <!-- modified by bai 增加了关注人的名字全称-->
<td colspan="2" valign="top"><strong><%= content_tag "div", link_to(user.name,user_path(user)), :class => "project_avatar_name" %> <td colspan="2" valign="top"><strong><%= content_tag "div", link_to(user.name,user_path(user)), :class => "project_avatar_name" %></strong>
</td> </td>
</tr> </tr>
<tr> <!-- modified by bai 区别了“关注”里个人参与的项目与课程--> <tr> <!-- modified by bai 区别了“关注”里个人参与的项目与课程-->
<td colspan="2" width="580px" ><p class="font_description"> <td colspan="2" width="580px" ><p class="font_description">
<% unless user.memberships.empty? %> <%# unless user.memberships.empty? %>
<% cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" %> <% cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" %>
<% memberships = user.memberships.all(:conditions => cond) %> <% memberships = user.memberships.all(:conditions => cond) %>
<%= l(:label_x_contribute_to, :count => memberships.count) %> <%= l(:label_x_contribute_to, :count => memberships.count) %>
<% for member in memberships %> <% for member in memberships %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %> <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %>
<% end %> <% end %>
<% end %> <%# end %>
</p> </p>
<p class="font_description"> <p class="font_description">
<% unless user.memberships.empty? %> <%# unless user.memberships.empty? %>
<% cond = Project.visible_condition(User.current) + " AND projects.project_type = 1" %> <% user_courses = user_courses_list(user) %>
<% memberships = user.memberships.all(:conditions => cond) %> <%= l(:label_x_course_contribute_to, :count => user_courses.count) %>
<%= l(:label_x_course_contribute_to, :count => memberships.count) %> <% for course in user_courses %>
<% for member in memberships %> <%# if course.name != nil %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %> <%= link_to course.name,{:controller => 'courses',:action => 'show',id:course.id, host: Setting.course_domain} %><%= (user_courses.last == course) ? '' : '' %>
<% end %> <%# end %>
<% end %> <% end %>
<%# end %>
</p> </p>
</td> </td>
</tr> </tr>
<!-- end --> <!-- end -->