From 7e2834f68062f7e4b62e1f4a56f0c5e20521e887 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 28 Oct 2016 10:46:00 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E5=87=BA=E9=A1=B9=E7=9B=AE=E6=88=90?= =?UTF-8?q?=E5=91=98=E4=BB=A5=E5=8F=8A=E9=A1=B9=E7=9B=AE=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E7=A0=81=E6=98=BE=E7=A4=BA=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 2 +- app/views/projects/_invite_code.html.erb | 5 +++++ app/views/projects/exit_project.js.erb | 3 ++- app/views/projects/show.html.erb | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 app/views/projects/_invite_code.html.erb 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 %>