1、消息“同意加入”添加权限控制,项目成员不显示

2、区别项目成员和非项目成员的不同样式
3、访问项目和成员列表--则设置项目邀请消息为已读
This commit is contained in:
huang 2015-09-19 16:18:54 +08:00
parent b623894976
commit b207c231f7
2 changed files with 16 additions and 3 deletions

View File

@ -259,7 +259,7 @@ class ProjectsController < ApplicationController
# Author lizanle
# Description 项目动态展示方法,删除了不必要的代码
def show
update_invite_message(User.current, @project)
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
return
end
@ -464,6 +464,8 @@ class ProjectsController < ApplicationController
# by young
# include CoursesHelper
def member
# 更新消息状态
update_invite_message(User.current, @project)
# 消息"同意加入项目"
if params[:message_id]
message_invite(params[:message_id], params[:key])
@ -523,6 +525,13 @@ class ProjectsController < ApplicationController
@members = paginateHelper @members
end
def update_invite_message(user, project)
forge_invite_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type =?", user, project, "ProjectInvite")
forge_invite_messages.each do |forge_invite_messages|
forge_invite_messages.update_attribute(:viewed, true)
end
end
def message_invite(message_id, key)
forge_message = ForgeMessage.find(message_id)
if key == forge_message.secret_key

View File

@ -364,7 +364,11 @@
<%=link_to inviter, user_path(inviter), :class => "newsBlue homepageNewsPublisher" %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">邀请你加入项目:</span>
</li>
<li class="homepageHomeworkContent fl">
<% if ma.user.member_of?(ma.project) %>
<li class="homepageNewsContent fl">
<% else %>
<li class="homepageHomeworkContent fl">
<% end %>
<%= link_to ma.project, project_path(ma.project),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover => "message_titile_show($(this),event)",
@ -373,7 +377,7 @@
<div style="display: none" class="message_title_red system_message_style">
<%= ma.project %>
</div>
<% if User.current == @user %>
<% unless ma.user.member_of?(ma.project) %>
<li class="homepageHomeworkContentWarn fl">
<%=link_to "同意加入", {:controller => 'projects', :action => 'member', :id => ma.project_id, :message_id =>ma.id, :key => ma.secret_key},
:value => ma.secret_key,