<%= l(:label_member_list) if params[:role].blank? %>

<%= error_messages_for 'member' %> <% roles = Role.find_all_givable %> <% members = @project.member_principals.includes(:roles, :principal).all.sort %> <% members = searchPeopleByRoles(@project, 3).sort if params[:role] == '1' %> <% members = searchPeopleByRoles(@project, 5).sort if params[:role] == '2' %> <% if @project.project_type == 1 %> <%= render :partial => 'member_list', :locals => {:members => members} %> <% else %> <% users = UserGrade.find_by_sql("select * from user_grades where project_id = #{@project.id}")%> <% if users %> <% users = users.sort {|a,b| b[:grade] <=> a[:grade]} %> <% temp = [] %> <% users.each do |user|%> <% members.each do |member|%> <% if member[:user_id] == user[:user_id] %> <% temp << member %> <% end %> <% end %> <% end %> <% temps = temp %> <%= render :partial => 'member_list', :locals => {:members => temps} %> <% end %> <% end %>