fix course list bug
This commit is contained in:
parent
4bef2eee24
commit
cf40f9ff02
|
@ -0,0 +1,45 @@
|
|||
<% if members.any? %>
|
||||
<% members.each do |member| %>
|
||||
<div class="well">
|
||||
<% next if member.new_record? %>
|
||||
<% unless member.created_on.nil? %>
|
||||
<%= content_tag "p", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "float_right member_since" %>
|
||||
<% end %>
|
||||
<%= member.user.nil? ? '' : (link_to image_tag(url_to_avatar(member.user), :class => 'avatar'), :class => "avatar") %>
|
||||
<%= content_tag "div", link_to_user(member.principal), :class => "nomargin avatar_name" %>
|
||||
|
||||
<% if @project.project_type == 1 %>
|
||||
<div class ="clear avatar_name">
|
||||
<p>
|
||||
<% if member.roles.sort.collect(&:to_s).join(', ') =='Manager' %>
|
||||
<%= l(:label_teacher) %>
|
||||
<% elsif member.roles.sort.collect(&:to_s).join(', ') =='Reporter' %>
|
||||
<%= l(:label_student) %>
|
||||
<% elsif member.roles.sort.collect(&:to_s).join(', ') =='TA' %>
|
||||
<%= l(:label_TA) %>
|
||||
<% else %>
|
||||
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<% else%>
|
||||
<%= content_tag "div", content_tag("p", member.roles.sort.collect(&:to_s).join(', ')), :class => "clear avatar_name" %>
|
||||
<% users.each do |user|%>
|
||||
<% if user[:user_id] == member[:user_id]%>
|
||||
<div class="clear avatar_user">
|
||||
<p>
|
||||
<%= l(:label_user_for_project_grade) %>: <span style="color:red"><%= user[:grade] %></span>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= call_hook(:view_projects_settings_members_table_row, { :project => @project, :member => member}) %>
|
||||
</div>
|
||||
<% end; reset_cycle %>
|
||||
<% else %>
|
||||
<p class="nodata">
|
||||
<%= l(:label_no_data) %>
|
||||
</p>
|
||||
<% end %>
|
|
@ -1,66 +1,31 @@
|
|||
|
||||
<div class="member_header"><p><%= l(:label_member_list)%></p></div>
|
||||
<div class="member_header">
|
||||
<p>
|
||||
<%= l(:label_member_list)%>
|
||||
</p>
|
||||
</div>
|
||||
<div class="member_content">
|
||||
<%= error_messages_for 'member' %>
|
||||
<% roles = Role.find_all_givable
|
||||
members = @project.member_principals.includes(:roles, :principal).all.sort %>
|
||||
<%
|
||||
users = UserGrade.find_by_sql("select * from user_grades where project_id = #{@project.id}").sort {|a,b| a[:grade] <=> b[:grade]}
|
||||
%>
|
||||
<% temp = [] %>
|
||||
<% users.each do |user|%>
|
||||
<% members.each do |member|%>
|
||||
<% if member[:user_id] == user[:user_id] %>
|
||||
<% temp << member%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% temps = temp.reverse %>
|
||||
<% if temps.any? %>
|
||||
<% temps.each do |member| %>
|
||||
<div class="well">
|
||||
<!--Modified by nie-->
|
||||
<% next if member.new_record? %>
|
||||
<% unless member.created_on.nil? %>
|
||||
<%= content_tag "p", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "float_right member_since" %>
|
||||
<% end %>
|
||||
<%= member.user.nil? ? '' : (link_to image_tag(url_to_avatar(member.user), :class => 'avatar'), :class => "avatar") %>
|
||||
<%= content_tag "div", link_to_user(member.principal), :class => "nomargin avatar_name" %>
|
||||
|
||||
<!-- added by huang modified by bai-->
|
||||
<% if @project.project_type == 1 %>
|
||||
<div class ="clear avatar_name"> <p>
|
||||
<% if member.roles.sort.collect(&:to_s).join(', ') =='Manager' %>
|
||||
<%= l(:label_teacher) %>
|
||||
<% elsif member.roles.sort.collect(&:to_s).join(', ') =='Reporter' %>
|
||||
<%= l(:label_student) %>
|
||||
<% elsif member.roles.sort.collect(&:to_s).join(', ') =='TA' %>
|
||||
<%= l(:label_TA) %>
|
||||
<% else %>
|
||||
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<% else%>
|
||||
<%= content_tag "div", content_tag("p", member.roles.sort.collect(&:to_s).join(', ')), :class => "clear avatar_name" %>
|
||||
<% users.each do |user|%>
|
||||
<% if user[:user_id] == member[:user_id]%>
|
||||
<div class="clear avatar_user">
|
||||
<p><%= l(:label_user_for_project_grade) %>: <span style="color:red"><%= user[:grade] %></span></p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!-- end -->
|
||||
<%= call_hook(:view_projects_settings_members_table_row, { :project => @project, :member => member}) %>
|
||||
|
||||
</div>
|
||||
<% end; reset_cycle %>
|
||||
<% else %>
|
||||
<p class="nodata">
|
||||
<%= l(:label_no_data) %>
|
||||
</p>
|
||||
<% end %>
|
||||
<%= error_messages_for 'member' %>
|
||||
<% roles = Role.find_all_givable
|
||||
members = @project.member_principals.includes(:roles, :principal).all.sort %>
|
||||
<% if @project.project_type == 1 %>
|
||||
<% else %>
|
||||
<% users = UserGrade.find_by_sql("select * from user_grades where project_id = #{@project.id}")%>
|
||||
<% if users %>
|
||||
<% users.sort {|a,b| a[:grade] <=> b[:grade]} %>
|
||||
|
||||
<% temp = [] %>
|
||||
<% users.each do |user|%>
|
||||
<% members.each do |member|%>
|
||||
<% if member[:user_id] == user[:user_id] %>
|
||||
<% temp << member%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% members = temp.reverse %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= render :partial => 'member_list', :locals => {:members => members} %>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue