退出项目成员以及项目邀请码显示权限

This commit is contained in:
huang 2016-10-28 10:46:00 +08:00
parent 52ae2ef5a3
commit 7e2834f680
4 changed files with 9 additions and 3 deletions

View File

@ -838,7 +838,7 @@ class ProjectsController < ApplicationController
@project = Project.find params[:id]
if User.current.login?
members = Member.where(:user_id => User.current.id, :project_id=>params[:id]).first
if members != nil && members.roles.first.to_s != "Manager"
if User.current != @project.owner
members.destroy
# 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除
applied_projects = AppliedProject.where(:project_id => @project.id, :user_id => members.user_id).first

View File

@ -0,0 +1,5 @@
<h2>项目简介
<% if User.current.member_of?(@project) %>
<span class="fr mr15" id="project_invite_code">邀请码:<span class="c_orange"><%= @project.invite_code %></span></span>
<% end %>
</h2>

View File

@ -1 +1,2 @@
$('#join_exit_project_div').html("<%= escape_javascript(render(:partial => 'layouts/join_exit_project')) %>");
$('#join_in_project_applied').html("<%= escape_javascript(render(:partial => 'projects/applied_status')) %>");
$('#project_invite_code').html("<%= escape_javascript(render(:partial => 'projects/invite_code')) %>");

View File

@ -1,6 +1,6 @@
<!--新版项目头部结束-->
<div class="pro_new_info mb10">
<h2>项目简介<span class="fr mr15">邀请码:<span class="c_orange"><%= @project.invite_code %></span></span></h2>
<div id="project_invite_code"><%= render :partial => 'projects/invite_code' %></div>
<% if @project.description.blank? %>
<p class="break_word"><%= @project.name %><p>
<% else %>