申请加入项目消息刷新,同时更新其它管理员的消息状态
This commit is contained in:
parent
0b113bb985
commit
94b36e227c
|
@ -75,13 +75,19 @@ class MembersController < ApplicationController
|
|||
project.members << members
|
||||
project.project_infos << project_info
|
||||
project.user_grades << user_grades unless user_grades.first.user_id.nil?
|
||||
@applied_message.update_attribute(:status, 2)
|
||||
|
||||
# 添加成功后所有管理员收到的消息状态都要更新
|
||||
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 => 7)
|
||||
@applied_message = AppliedMessage.find(params[:applied_message_id])
|
||||
# 添加成功后,申请人收到消息
|
||||
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,
|
||||
:status => 6, :viewed => true, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_id)
|
||||
:status => 6, :viewed => false, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_id)
|
||||
|
||||
# 添加成功后,批准人收到消息
|
||||
AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,
|
||||
:status => 7, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id)
|
||||
# AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,
|
||||
# :status => 7, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id)
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
|
@ -95,14 +101,19 @@ class MembersController < ApplicationController
|
|||
# status(1:申请的消息;2:已操作过该消息(包括同意或者拒绝,消息状态更新);3:拒绝消息;4:被拒人收到消息;5:拒绝者收到消息;6:同意后申请人收到消息;7:同意后批准人收到消息)
|
||||
def refused_allow_to_join_project
|
||||
@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
|
||||
# 发送消息给被拒者,user_id对应的收到信息的用户
|
||||
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4,
|
||||
:viewed => true, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_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)
|
||||
|
||||
# 拒绝功后所有管理员收到的消息状态都要更新
|
||||
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)
|
||||
@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)
|
||||
applied_project.delete
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% if @flash_message %>
|
||||
alert("<%= @flash_message %>");
|
||||
<% else%>
|
||||
$("#applied_project_<%= @applied_message.id %>").html('<%= render :partial => "users/user_message_applide_action", :locals =>{:ma => @applied_message} %>');
|
||||
$("#applied_project_<%= @applied_message.id %>").html('<%= escape_javascript(render :partial => 'users/applied_project_content', :locals => {:ma => @applied_message}) %>');
|
||||
<% end%>
|
||||
|
|
|
@ -1 +1 @@
|
|||
$("#applied_project_<%= @applied_message.id %>").html('<%= render :partial => "users/user_message_applide_action", :locals =>{:ma => @applied_message} %>');
|
||||
$("#applied_project_<%= @applied_message.id %>").html('<%= escape_javascript(render :partial => 'users/applied_project_content', :locals => {:ma => @applied_message}) %>');
|
|
@ -0,0 +1,15 @@
|
|||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(applied_project_users(ma)), :width => "30", :height => "30"), user_path(applied_project_users(ma)), :target => '_blank' %></a>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<%= render :partial => "users/user_message_applide_users", :locals =>{:ma => ma} %>
|
||||
</li>
|
||||
<li class="homepageNewsContent fl" style="width:283px;"><a href="javascript:void(0);" class="newsGrey">
|
||||
以“<%= applied_project_message_type(ma.role) %>”身份加入<% project = Project.find(ma.project_id) %>
|
||||
<%= link_to project.name, project_path(ma.project_id), :class => "link-blue", :target => '_blank', :title => "#{project.name}" %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="fl" style="width:71px; height:49px;">
|
||||
<span><%= render :partial => "users/user_message_applide_action", :locals =>{:ma => ma} %></span>
|
||||
</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
|
@ -1,3 +1,4 @@
|
|||
<% ma = ma.nil? ? @applied_message : ma %>
|
||||
<% if allow_to_show(ma) %>
|
||||
<%= link_to "同意", allow_to_join_project_project_memberships_path(:project_id => ma.project_id, :applied_message_id => ma.id), :remote => true, :method => :post, :class => "link-blue"%> |
|
||||
<%= 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" %>
|
||||
|
|
|
@ -47,25 +47,8 @@
|
|||
</ul>
|
||||
<% end %>
|
||||
<% elsif ma && ma.applied_type == "AppliedProject" %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(applied_project_users(ma)), :width => "30", :height => "30"), user_path(applied_project_users(ma)), :target => '_blank' %></a>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<%= render :partial => "users/user_message_applide_users", :locals =>{:ma => ma} %>
|
||||
</li>
|
||||
<li class="homepageNewsContent fl" style="width:283px;"><a href="javascript:void(0);" class="newsGrey">
|
||||
以“<%= applied_project_message_type(ma.role) %>”身份加入
|
||||
<% project = Project.find(ma.project_id) %>
|
||||
<%= link_to project.name, project_path(ma.project_id), :class => "link-blue", :target => '_blank', :title => "#{project.name}" %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="fl" style="width:71px; height:49px;">
|
||||
<span id="applied_project_<%= ma.id %>">
|
||||
<%= render :partial => "users/user_message_applide_action", :locals =>{:ma => ma} %>
|
||||
</span>
|
||||
</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
<ul class="homepageNewsList fl" id="applied_project_<%= ma.id %>">
|
||||
<%= render :partial => "users/applied_project_content", :locals =>{:ma => ma} %>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
Loading…
Reference in New Issue