修改邀请加入项目逻辑:改成已加入和等待加入

This commit is contained in:
huang 2015-06-06 11:39:22 +08:00
parent 7e89cd27aa
commit 543ae1bbd0
2 changed files with 14 additions and 17 deletions

View File

@ -365,16 +365,17 @@ class ProjectsController < ApplicationController
def invite_members_by_mail
if User.current.member_of?(@project) || User.current.admin?
@inviter_lists = InviteList.where(project_id:@project.id).all
@inviters = []
@waiters = []
unless @inviter_lists.blank?
@inviter_lists.each do|inviter_list|
inviters = []
waiters = []
inviters << inviter_list.user
@inviters_count = inviters.size
unless inviter_list.user.nil?
unless inviter_list.user.member_of?(@project)
waiters << inviter_list.user
@waiters_count = waiters.size
if inviter_list.user.member_of?(@project)
@inviters << inviter_list.user
@inviters_count = @inviters.size
else
@waiters << inviter_list.user
@waiters_count = @waiters.size
end
end
end

View File

@ -80,21 +80,17 @@
<%# 邀请用户的状态 %>
<% unless @inviter_lists.blank? %>
<div>
<% if @inviters_count > 0 %>
<span class="status_inviter">已邀请的用户</span><br/>
<% @inviter_lists.each do |inviter_list| %>
<%= inviter_list.user.name unless inviter_list.user.nil? %><br/>
<% unless @inviters_count.nil? %>
<span class="status_inviter">已加入项目的用户</span><br/>
<% @inviters.each do |inv| %>
<%= inv.name unless inv.nil? %><br/>
<% end %>
<% end %>
</br>
<% unless @waiters_count.nil? %>
<span class="status_inviter">等待加入项目的用户</span><br/>
<% @inviter_lists.each do |inviter_list| %>
<% unless inviter_list.user.nil? %>
<% unless inviter_list.user.member_of?(@project) %>
<%= inviter_list.user.name %><br/>
<% end %>
<% end %>
<% @waiters.each do |wai| %>
<%= wai.name unless wai.nil?%><br/>
<% end %>
<% end %>
</div>