diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 55c4dac72..ba71f1c5f 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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 diff --git a/app/views/projects/_invite_code.html.erb b/app/views/projects/_invite_code.html.erb new file mode 100644 index 000000000..2ca55a1d2 --- /dev/null +++ b/app/views/projects/_invite_code.html.erb @@ -0,0 +1,5 @@ +

项目简介 +<% if User.current.member_of?(@project) %> + 邀请码:<%= @project.invite_code %> +<% end %> +

\ No newline at end of file diff --git a/app/views/projects/exit_project.js.erb b/app/views/projects/exit_project.js.erb index 709f878be..086ff3982 100644 --- a/app/views/projects/exit_project.js.erb +++ b/app/views/projects/exit_project.js.erb @@ -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')) %>"); diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 2e3063459..fa6986046 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -1,6 +1,6 @@
-

项目简介邀请码:<%= @project.invite_code %>

+
<%= render :partial => 'projects/invite_code' %>
<% if @project.description.blank? %>

<%= @project.name %>

<% else %>