项目邀请码申请及弹框

This commit is contained in:
huang 2016-07-28 10:18:35 +08:00
parent b1f69140c7
commit 7413298aad
6 changed files with 52 additions and 34 deletions

View File

@ -43,6 +43,24 @@ class AppliedProjectController < ApplicationController
# end
end
# @flage:提示语标志1 邀请码错误2 已经是项目成员; 3 角色没有选择; 4 申请成功)
# 申请成功则发送消息
def applied_project_info
@project = Project.find(params[:project_id])
if params[:invite_code].to_s != @project.invite_code
@flag = 1
elsif User.current.member_of?(@project)
@flag = 2
elsif params[:member_manager] != "on" || params[:member_developer] != "on" || params[:member_reporter] != "on"
@flag = 3
else
@flag = 4
end
if @flag == 4
end
end
#取消申请
def unapplied_join_project
@project = Project.find(params[:project_id])

View File

@ -364,7 +364,7 @@ module WatchersHelper
:class => "pr_join_a" ,:id=>id
end
#申请加入项目
# 申请加入项目
def join_in_project_link(project, user, options=[])
applied = project.applied_projects.find_by_user_id(user.id)
text = applied ? l(:label_unapply_project) : l(:label_apply_project)

View File

@ -1,28 +1,29 @@
<div class="sy_popup_top">
<h3 class="fl">欢迎加入项目</h3>
<a href="javascript:void(0);" class="sy_icons_close fr"></a>
<div class="cl"></div>
</div>
<div class="sy_popup_con" style="width:370px;">
<ul class="sy_popup_add ">
<li>
<label >项目邀请码:</label>
<input class=" sy_input_txt fl" placeholder="请输入六位项目邀请码" style="width:250px">
<div class="cl"></div>
</li>
<li>
<label >身份:</label>
<input type="radio" class="ml5 mr5 " /><span class="mr10">管理人员</span>
<input type="radio" class="ml5 mr5 " /><span class="mr10">开发人员</span>
<input type="radio" class="ml5 mr5 " /><span class="mr10">报告人员</span>
<div class="cl"></div>
</li>
<li>
<label>&nbsp;</label>
<a href="javascript:void(0);" class="sy_btn_blue fl">确&nbsp;&nbsp;定</a>
<a href="javascript:void(0);" class="sy_btn_grey fl ml20">取&nbsp;&nbsp;消</a>
<div class="cl"></div>
</li>
</ul>
</div>
<div class="sy_popup_top">
<h3 class="fl">欢迎加入项目</h3>
<a href="javascript:void(0);" class="sy_icons_close fr"></a>
<div class="cl"></div>
</div>
<div class="sy_popup_con" style="width:370px;">
<%= form_tag( url_for(:controller => 'applied_project', :action => 'applied_project_info', :project_id => @project.id), :id => 'project_applied_form') do %>
<ul class="sy_popup_add ">
<li>
<label >项目邀请码:</label>
<input name="invite_code" class=" sy_input_txt fl" placeholder="请输入六位项目邀请码" style="width:250px"/>
<div class="cl"></div>
</li>
<li>
<label >身份:</label>
<input name="member_manager" type="radio" class="ml5 mr5 " /><span class="mr10">管理人员</span>
<input name="member_developer" type="radio" class="ml5 mr5 " /><span class="mr10">开发人员</span>
<input name="member_reporter" type="radio" class="ml5 mr5 " /><span class="mr10">报告人员</span>
<div class="cl"></div>
</li>
<li>
<label>&nbsp;</label>
<div class="courseSendSubmit mr15"><a href="javascript:void(0);" class="sy_btn_blue fl" onclick="$('#project_applied_form').submit();hideModal()">确&nbsp;&nbsp;定</a></div>
<a href="javascript:void(0);" class="sy_btn_grey fl ml20" onclick="hideModal()">取&nbsp;&nbsp;消</a>
<div class="cl"></div>
</li>
</ul>
<% end %>
</div>

View File

@ -1,7 +1,5 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'applied_join_project', locals: { :course => @course}) %>');
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'applied_join_project', locals: { }) %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().css({"top":"40%","left":"50%","transform":"translate(-50%,-50%)","padding":"0","border":"none"});
$('#ajax-modal').css({"padding":"0"});

View File

@ -722,6 +722,7 @@ RedmineApp::Application.routes.draw do
delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue'
post 'applied_project/applied_join', :to => 'applied_project#applied_join_project', :as => 'applied_join_project'
post 'applied_project/applied_project_info', :to => 'applied_project#applied_project_info', :as => 'applied_project_info'
delete 'applied_project/applied', :to => 'applied_project#unapplied_join_project', :as => 'unapplied_join_project'
resources :projects do