项目加入申请,被审批后,其他管理员的消息显示加入操作人姓名(并将提示弹框改为新版)

This commit is contained in:
daiao 2016-12-22 13:48:03 +08:00
parent c42861c8b5
commit 884a201953
7 changed files with 79 additions and 27 deletions

View File

@ -57,10 +57,10 @@ class MembersController < ApplicationController
@applied_message = AppliedMessage.find(params[:applied_message_id]) @applied_message = AppliedMessage.find(params[:applied_message_id])
applied_project = @applied_message.applied applied_project = @applied_message.applied
user = User.find(@applied_message.applied_user_id) user = User.find(@applied_message.applied_user_id)
project = Project.find(applied_project.project_id) project = Project.find(applied_project.project_id) if !applied_project.nil?
if user.member_of?(project) if user.member_of?(project)|| AppliedMessage.where(:applied_id => @applied_message.applied_id, :status => 1).count == 0
@flash_message = "您已经是项目成员了" @flash_message = "该申请已被其他管理员处理"
@applied_message.update_attribute(:status, 2) # @applied_message.update_attribute(:status, 2)
else else
ap_role = applied_project.try(:role) ap_role = applied_project.try(:role)
if ap_role if ap_role
@ -104,7 +104,12 @@ class MembersController < ApplicationController
@applied_message = AppliedMessage.find(params[:applied_message_id]) @applied_message = AppliedMessage.find(params[:applied_message_id])
# @applied_message.update_attribute(:status, 3) # @applied_message.update_attribute(:status, 3)
applied_project = @applied_message.applied applied_project = @applied_message.applied
project = Project.find(@applied_message.project_id) 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对应的收到信息的用户 # 发送消息给被拒者,user_id对应的收到信息的用户
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4, 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) :viewed => false, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_id)
@ -123,6 +128,7 @@ class MembersController < ApplicationController
applied_project.delete applied_project.delete
end end
end
def create def create
if params[:refusal_button] if params[:refusal_button]

View File

@ -145,11 +145,11 @@ module UsersHelper
when 4 when 4
"被拒绝" "被拒绝"
when 5 when 5
"已拒绝" "已拒绝"
when 6 when 6
"已通过" "已通过"
when 7 when 7
"已同意" "已同意"
end end
end end

View File

@ -5,7 +5,7 @@
<div class="fl"> <div class="fl">
<ul> <ul>
<li class="navHomepageMenu fl"> <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>
<!-- <li class="navHomepageMenu fl"> <!-- <li class="navHomepageMenu fl">
<%#= link_to "资源库", user_resource_user_path(User.current, :type => 1), :class => "c_white f16 db p10" %> <%#= link_to "资源库", user_resource_user_path(User.current, :type => 1), :class => "c_white f16 db p10" %>

View File

@ -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">&nbsp;</label>
<a href="javascript:void(0);" class="sy_btn_grey fl" onclick="hideModal()">取&nbsp;&nbsp;消</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()">确&nbsp;&nbsp;定</a>
<div class="cl"></div>
</li>
</ul>
</div>
</div>

View File

@ -1,5 +1,6 @@
<% if @flash_message %> <% if @flash_message %>
alert("<%= @flash_message %>"); var htmlvalue = "<%= escape_javascript(render :partial => 'members/delete_message_tip') %>";
pop_box_new(htmlvalue,300,316);
<% else%> <% else%>
$("#applied_project_<%= @applied_message.id %>").html('<%= escape_javascript(render :partial => 'users/applied_project_content', :locals => {:ma => @applied_message}) %>'); $("#applied_project_<%= @applied_message.id %>").html('<%= escape_javascript(render :partial => 'users/applied_project_content', :locals => {:ma => @applied_message}) %>');
<% end%> <% end%>

View File

@ -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 %>

View File

@ -4,12 +4,30 @@
:remote => true, :method => :post, :class => "link-blue", :style => "font-size: 14px;" %> | :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), <%= 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;" %> :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 %> <% 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 %> <% 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 %> <% 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 %> <% 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 %> <% end %>