+
+
+
diff --git a/app/controllers/applied_project_controller.rb b/app/controllers/applied_project_controller.rb
index 3d061ef74..d7b65174f 100644
--- a/app/controllers/applied_project_controller.rb
+++ b/app/controllers/applied_project_controller.rb
@@ -3,7 +3,24 @@ class AppliedProjectController < ApplicationController
#申请加入项目
def applied_join_project
@user_id = params[:user_id]
- @project = Project.find(params[:project_id])
+ @project = Project.find_by_id(params[:project_id])
+ if params[:project_join]
+ if @project
+ @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])
+ Mailer.applied_project(appliedproject).deliver
+ end
+ @status = 1
+ else
+ @status = 0
+ end
+ respond_to do |format|
+ format.js
+ end
+ return
+ end
+
@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])
diff --git a/app/views/applied_project/applied_join_project.js.erb b/app/views/applied_project/applied_join_project.js.erb
new file mode 100644
index 000000000..9fd358ede
--- /dev/null
+++ b/app/views/applied_project/applied_join_project.js.erb
@@ -0,0 +1,7 @@
+<% if @status == 0%>
+ alert("您申请的项目不存在");
+<% elsif @status == 1%>
+ alert("申请成功");
+<%else%>
+ alert("申请失败");
+<%end%>
\ No newline at end of file
diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb
index abb896b61..c5be3f4fd 100644
--- a/app/views/layouts/mailer.html.erb
+++ b/app/views/layouts/mailer.html.erb
@@ -44,9 +44,7 @@ a:hover.mail_reply{ background:#06a9bc; text-decoration:none;}
<%= l(:mail_issue_greetings)%>
<%= yield %>
-
-
-
+