项目加入申请,被审批后,其他管理员的消息显示加入操作人姓名(并将提示弹框改为新版)
This commit is contained in:
parent
c42861c8b5
commit
884a201953
|
@ -57,10 +57,10 @@ class MembersController < ApplicationController
|
|||
@applied_message = AppliedMessage.find(params[:applied_message_id])
|
||||
applied_project = @applied_message.applied
|
||||
user = User.find(@applied_message.applied_user_id)
|
||||
project = Project.find(applied_project.project_id)
|
||||
if user.member_of?(project)
|
||||
@flash_message = "您已经是项目成员了"
|
||||
@applied_message.update_attribute(:status, 2)
|
||||
project = Project.find(applied_project.project_id) if !applied_project.nil?
|
||||
if user.member_of?(project)|| AppliedMessage.where(:applied_id => @applied_message.applied_id, :status => 1).count == 0
|
||||
@flash_message = "该申请已被其他管理员处理"
|
||||
# @applied_message.update_attribute(:status, 2)
|
||||
else
|
||||
ap_role = applied_project.try(:role)
|
||||
if ap_role
|
||||
|
@ -104,24 +104,30 @@ class MembersController < ApplicationController
|
|||
@applied_message = AppliedMessage.find(params[:applied_message_id])
|
||||
# @applied_message.update_attribute(:status, 3)
|
||||
applied_project = @applied_message.applied
|
||||
project = Project.find(@applied_message.project_id)
|
||||
# 发送消息给被拒者,user_id对应的收到信息的用户
|
||||
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4,
|
||||
project = Project.find(@applied_message.project_id) if !applied_project.nil?
|
||||
user = User.find(@applied_message.applied_user_id)
|
||||
if user.member_of?(project) || AppliedMessage.where(:applied_id => @applied_message.applied_id, :status => 1).count == 0
|
||||
@flash_message = "该申请已被其他管理员处理"
|
||||
# @applied_message.update_attribute(:status, 2)
|
||||
else
|
||||
# 发送消息给被拒者,user_id对应的收到信息的用户
|
||||
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4,
|
||||
:viewed => false, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_id)
|
||||
|
||||
# 拒绝功后所有管理员收到的消息状态都要更新
|
||||
applied_messages = AppliedMessage.where(:applied_id => @applied_message.applied_id, :project_id => @applied_message.project_id, :status => 1,
|
||||
# 拒绝功后所有管理员收到的消息状态都要更新
|
||||
applied_messages = AppliedMessage.where(:applied_id => @applied_message.applied_id, :project_id => @applied_message.project_id, :status => 1,
|
||||
:applied_type => "AppliedProject")
|
||||
applied_messages.update_all(:status => 5, :viewed => true)
|
||||
@applied_message = AppliedMessage.find(params[:applied_message_id])
|
||||
# AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 5,
|
||||
# :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id)
|
||||
ps = ProjectsService.new
|
||||
user = User.find(@applied_message.applied_user_id)
|
||||
ap_role = applied_project.try(:role)
|
||||
ps.send_wechat_join_project_notice user,project,ap_role,1
|
||||
applied_messages.update_all(:status => 5, :viewed => true)
|
||||
@applied_message = AppliedMessage.find(params[:applied_message_id])
|
||||
# AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 5,
|
||||
# :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id)
|
||||
ps = ProjectsService.new
|
||||
user = User.find(@applied_message.applied_user_id)
|
||||
ap_role = applied_project.try(:role)
|
||||
ps.send_wechat_join_project_notice user,project,ap_role,1
|
||||
|
||||
applied_project.delete
|
||||
applied_project.delete
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
|
@ -145,11 +145,11 @@ module UsersHelper
|
|||
when 4
|
||||
"被拒绝"
|
||||
when 5
|
||||
"您已拒绝"
|
||||
"已拒绝"
|
||||
when 6
|
||||
"已通过"
|
||||
when 7
|
||||
"您已同意"
|
||||
"已同意"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<div class="fl">
|
||||
<ul>
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "首页",user_activities_path(User.current), :class => "c_white f16 db p10", :title => "回到个人首页", :target => "_blank"%>
|
||||
<%= link_to "首页", user_activities_path(User.current), :class => "c_white f16 db p10", :title => "回到个人首页", :target => "_blank"%>
|
||||
</li>
|
||||
<!-- <li class="navHomepageMenu fl">
|
||||
<%#= link_to "资源库", user_resource_user_path(User.current, :type => 1), :class => "c_white f16 db p10" %>
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<div style="width:460px;">
|
||||
<div class="sy_popup_top">
|
||||
<h3 class="fl">提示</h3>
|
||||
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="sy_popup_con" style="width:380px;">
|
||||
<ul class="sy_popup_add" >
|
||||
|
||||
<li class="center mb5" style="line-height:20px;text-align: center;">
|
||||
<%= @flash_message %>
|
||||
</li>
|
||||
<li class="mt10">
|
||||
<label class="mr27"> </label>
|
||||
<a href="javascript:void(0);" class="sy_btn_grey fl" onclick="hideModal()">取 消</a>
|
||||
<%#= link_to "确 定", {:controller => 'repositories', :action => 'forked'}, :class => "sy_btn_blue fl ml20", :onclick => "hideModal();", :target => "_blank" %>
|
||||
<a href="javascript:void(0);" class="sy_btn_blue fl ml20" onclick="hideModal()">确 定</a>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
|
@ -1,5 +1,6 @@
|
|||
<% if @flash_message %>
|
||||
alert("<%= @flash_message %>");
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'members/delete_message_tip') %>";
|
||||
pop_box_new(htmlvalue,300,316);
|
||||
<% else%>
|
||||
$("#applied_project_<%= @applied_message.id %>").html('<%= escape_javascript(render :partial => 'users/applied_project_content', :locals => {:ma => @applied_message}) %>');
|
||||
<% end%>
|
||||
|
|
|
@ -1 +1,6 @@
|
|||
$("#applied_project_<%= @applied_message.id %>").html('<%= escape_javascript(render :partial => 'users/applied_project_content', :locals => {:ma => @applied_message}) %>');
|
||||
<% if @flash_message %>
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'members/delete_message_tip') %>";
|
||||
pop_box_new(htmlvalue,300,316);
|
||||
<% else%>
|
||||
$("#applied_project_<%= @applied_message.id %>").html('<%= escape_javascript(render :partial => 'users/applied_project_content', :locals => {:ma => @applied_message}) %>');
|
||||
<% end %>
|
|
@ -4,12 +4,30 @@
|
|||
:remote => true, :method => :post, :class => "link-blue", :style => "font-size: 14px;" %> |
|
||||
<%= link_to "拒绝", refused_allow_to_join_project_project_memberships_path(:project_id => ma.project_id, :applied_message_id => ma.id),
|
||||
:remote => true, :method => :get, :class => "link-blue",:style => "font-size: 14px;" %>
|
||||
<% elsif ma.status == 2 %>
|
||||
<span class="fontGrey3" style="font-size:14px;">已处理</span>
|
||||
<% elsif ma.status == 4 %>
|
||||
<span class="fontGrey3" style="font-size:14px">被拒绝</span>
|
||||
<% operator_message = AppliedMessage.where("applied_id=? and status not in (2,4)", ma.applied_id).first %>
|
||||
<% operator = User.find(operator_message.applied_user_id).show_name %>
|
||||
<span class="fontGrey3" style="font-size:14px" title="<%= operator %>已拒绝">
|
||||
<%= operator %>已拒绝
|
||||
</span>
|
||||
<% elsif ma.status == 5 %>
|
||||
<span class="fontGrey3" style="font-size:14px">您已拒绝</span>
|
||||
<% operator_message = AppliedMessage.where("applied_id=? and status not in (2,5)", ma.applied_id).first %>
|
||||
<% operator = User.find(operator_message.applied_user_id).show_name %>
|
||||
<span class="fontGrey3" style="font-size:14px" title="<%= operator %>已拒绝">
|
||||
<%= operator %>已拒绝
|
||||
</span>
|
||||
<% elsif ma.status == 6 %>
|
||||
<span class="fontGrey3" style="font-size:14px">已通过</span>
|
||||
<% operator_message = AppliedMessage.where("applied_id=? and status not in (2,6)", ma.applied_id).first %>
|
||||
<% operator = User.find(operator_message.applied_user_id).show_name %>
|
||||
<span class="fontGrey3" style="font-size:14px" title="<%= operator %>已同意">
|
||||
<%= operator %>已同意
|
||||
</span>
|
||||
<% elsif ma.status == 7 %>
|
||||
<span class="fontGrey3" style="font-size:14px">您已同意</span>
|
||||
<% operator_message = AppliedMessage.where("applied_id=? and status not in (2,7)", ma.applied_id).first %>
|
||||
<% operator = User.find(operator_message.applied_user_id).show_name %>
|
||||
<span class="fontGrey3" style="font-size:14px" title="<%= operator %>已同意">
|
||||
<%= operator %>已同意
|
||||
</span>
|
||||
<% end %>
|
Loading…
Reference in New Issue