学号显示问题

This commit is contained in:
yanxd 2013-12-17 16:01:46 +08:00
parent cca2e6c0fa
commit b0efdefa7d
3 changed files with 78 additions and 53 deletions

View File

@ -125,4 +125,14 @@ module BidsHelper
end
@users.count
end
def im_watching_student_id? bid
people = []
people << bid.author
bid.join_in_contests.each do |jic|
people << jic.user
end
people.include?(User.current)
end
end

View File

@ -152,7 +152,11 @@
<table width="100%">
<% if @bid.reward_type == 3 %>
<tr>
<td><%= l(:label_bidding_user_studentcode) %> : <%= b_project.user.user_extensions.student_id %></td>
<td>
<% if (im_watching_student_id? @bid) && user.user_extensions.identity.to_i.eql?(1) %>
<%= l(:label_bidding_user_studentcode) %> : <%= b_project.user.user_extensions.student_id %>
<% end %>
</td>
</tr>
<tr>
<td><%= l(:label_bidding_user_homework) %> :
@ -171,7 +175,11 @@
<%= b_project.user.lastname %><%= b_project.user.firstname %>
<% end %></strong>
<!-- added by bai 加入学号 -->
<p><strong><%= l(:label_bidding_user_studentcode) %> <%= b_project.user.user_extensions.student_id%></strong></p>
<p><strong>
<% if (im_watching_student_id? @bid) && b_project.user.user_extensions.identity.to_i.eql?(1) %>
<%= l(:label_bidding_user_studentcode) %> : <%= b_project.user.user_extensions.student_id %>
<% end %>
</strong></p>
</td>
<!-- end -->

View File

@ -3,56 +3,63 @@
<div class="inf_user_image">
<% for temp in @bid.join_in_contests %>
<% user = temp.user %>
<ul class="list_watch"><li>
<table width="660px" border="0" align="center">
<tr>
<!-- modified by bai 显示人名全称-->
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(user), :class => "avatar"),
user_path(user),
:title => "#{user.show_name}" %></td>
<td><table width="580px" border="0">
<tr>
<td colspan="2" valign="top"><strong><%= content_tag "div", link_to(user.show_name, user_path(user)), :class => "project_avatar_name" ,
:title => "#{user.show_name}" %>
<!-- added by bai 增加了学员的学号 -->
<%= l(:label_bidding_user_studentcode) %> <%= user.user_extensions.student_id%>
</td>
</tr>
<tr>
<!-- modified by bai 区分课程与项目-->
<td colspan="2" width="580px" ><p class="font_description">
<% unless user.memberships.empty? %>
<% cond = Project.visible_condition(User.current) + "AND projects.project_type <> 1" %>
<% memberships = user.memberships.all(:conditions => cond) %>
<%= l(:label_x_contribute_to, :count => memberships.count) %>
<% for member in memberships %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %>
<% end %>
<% end %>
</p>
<!-- added by bai -->
<p class="font_description">
<% 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 %>
<% end %>
</p>
<ul class="list_watch">
<li>
<table width="660px" border="0" align="center">
<tr>
<!-- modified by bai 显示人名全称-->
<td colspan="2" valign="top" width="50" >
<%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :title => "#{user.show_name}" %>
</td>
<td>
<table width="580px" border="0">
<tr>
<td colspan="2" valign="top"><%= content_tag "div", link_to(user.show_name, user_path(user)), :class => "project_avatar_name" , :title => "#{user.show_name}" %>
<!-- added by bai 增加了学员的学号 -->
<% if (im_watching_student_id? @bid) && user.user_extensions.identity.to_i.eql?(1) %>
<%= l(:label_bidding_user_studentcode) %> <%= user.user_extensions.student_id%>
<% end %>
</td>
</tr>
<tr>
<!-- modified by bai 区分课程与项目-->
<td colspan="2" width="580px" >
<p class="font_description">
<% unless user.memberships.empty? %>
<% cond = Project.visible_condition(User.current) + "AND projects.project_type <> 1" %>
<% memberships = user.memberships.all(:conditions => cond) %>
<%= l(:label_x_contribute_to, :count => memberships.count) %>
<% for member in memberships %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %>
<% end %>
<% end %>
</p>
<!-- added by bai -->
<p class="font_description">
<% 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 %>
<% end %>
</p>
</td>
</tr>
<!-- end -->
<tr>
<td width="200" align="right" class="font_lighter">
<%= l(:label_user_joinin) %><%= format_date(user.created_on) %>
</td>
</tr>
</table>
</td>
</tr>
<!-- end -->
<tr>
<td width="200" align="right" class="font_lighter"><%= l(:label_user_joinin) %><%= format_date(user.created_on) %>
</td>
</tr>
</table></td>
</tr>
</table></li></ul>
<% end %>
</tr>
</table>
</li>
</ul>
<% end %>
</div>