首页加入项目增加已是当前项目的判断
This commit is contained in:
parent
a265556cfe
commit
87fdd840ec
|
@ -6,6 +6,10 @@ class AppliedProjectController < ApplicationController
|
|||
@project = Project.find_by_id(params[:project_id])
|
||||
if params[:project_join]
|
||||
if @project
|
||||
user = User.find @user_id
|
||||
if user.member_of?(@project)
|
||||
@status = 3
|
||||
else
|
||||
@applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
|
||||
if @applieds.count == 0
|
||||
appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
|
||||
|
@ -14,6 +18,7 @@ class AppliedProjectController < ApplicationController
|
|||
else
|
||||
@status = 1
|
||||
end
|
||||
end
|
||||
else
|
||||
@status = 0
|
||||
end
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
alert("请勿重复申请加入该项目");
|
||||
<% elsif @status == 2%>
|
||||
alert("申请成功");
|
||||
<% elsif @status == 3%>
|
||||
alert("您已加入该项目");
|
||||
<%else%>
|
||||
alert("申请失败");
|
||||
<%end%>
|
Loading…
Reference in New Issue