Merge branch 'szzh' into develop
This commit is contained in:
commit
0f7c52e279
|
@ -3,7 +3,24 @@ class AppliedProjectController < ApplicationController
|
||||||
#申请加入项目
|
#申请加入项目
|
||||||
def applied_join_project
|
def applied_join_project
|
||||||
@user_id = params[:user_id]
|
@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])
|
@applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
|
||||||
if @applieds.count == 0
|
if @applieds.count == 0
|
||||||
appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
|
appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<% if @status == 0%>
|
||||||
|
alert("您申请的项目不存在");
|
||||||
|
<% elsif @status == 1%>
|
||||||
|
alert("申请成功");
|
||||||
|
<%else%>
|
||||||
|
alert("申请失败");
|
||||||
|
<%end%>
|
|
@ -1,4 +1,3 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
@ -34,7 +33,7 @@
|
||||||
{
|
{
|
||||||
hideModal(obj);
|
hideModal(obj);
|
||||||
$("#new-watcher-form").submit();
|
$("#new-watcher-form").submit();
|
||||||
alert("申请成功");
|
// alert("申请成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
function hidden_join_course_form()
|
function hidden_join_course_form()
|
||||||
|
@ -60,6 +59,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li style="padding-top: 15px;">
|
<li style="padding-top: 15px;">
|
||||||
<span class="tips">项 目 ID:</span>
|
<span class="tips">项 目 ID:</span>
|
||||||
|
<input type="hidden" name="project_join" value="1">
|
||||||
<input type="hidden" name="user_id" value="<%= User.current.id%>">
|
<input type="hidden" name="user_id" value="<%= User.current.id%>">
|
||||||
<input class=" width190" name="project_id" id="project_id" type="text" value="" >
|
<input class=" width190" name="project_id" id="project_id" type="text" value="" >
|
||||||
<input type="text" style="display: none"/>
|
<input type="text" style="display: none"/>
|
||||||
|
|
Loading…
Reference in New Issue