From 0028c1142640b49ba78f0a339b79fede7d8016be Mon Sep 17 00:00:00 2001 From: linhk <304431313@.com> Date: Fri, 8 Aug 2014 16:43:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E5=87=BA=E9=A1=B9=E7=9B=AE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 4 ++-- app/controllers/projects_controller.rb | 13 ++++++++++++ app/helpers/watchers_helper.rb | 5 ++++- app/views/layouts/_join_exit_project.html.erb | 20 +++++++++++++++++++ app/views/layouts/base_projects.html.erb | 15 ++------------ app/views/projects/exit_project.js.erb | 1 + config/locales/en.yml | 1 + config/locales/zh.yml | 1 + config/routes.rb | 1 + 9 files changed, 45 insertions(+), 16 deletions(-) create mode 100644 app/views/layouts/_join_exit_project.html.erb create mode 100644 app/views/projects/exit_project.js.erb diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index c1b38fa39..4174f427e 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -119,8 +119,8 @@ class AccountController < ApplicationController @user = User.new @user.safe_attributes = user_params if params[:identity] == "2" # 2 企业 - #@user.firstname = params[:enterprise_name] - #@user.lastname = l(:field_enterprise) + @user.firstname = params[:enterprise_name] + @user.lastname = l(:field_enterprise) end @user.admin = false @user.register diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 3f6827159..1bc75d9d1 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -892,6 +892,18 @@ class ProjectsController < ApplicationController end end + def exit_project + @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.destroy + end + respond_to do |format| + format.js + end + end + end private def memberAccess @@ -1038,4 +1050,5 @@ class ProjectsController < ApplicationController end #gcmend + end diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index ea72e8184..be5609d7c 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -246,4 +246,7 @@ module WatchersHelper link_to text, url, :remote => true, :method => method ,:class=>css end - end + def exit_project_link(project) + link_to("退出项目",exit_cur_project_path(project.id),:remote => true ) + end + end diff --git a/app/views/layouts/_join_exit_project.html.erb b/app/views/layouts/_join_exit_project.html.erb new file mode 100644 index 000000000..c43ad55a2 --- /dev/null +++ b/app/views/layouts/_join_exit_project.html.erb @@ -0,0 +1,20 @@ +