From 48ac3dbea8eb14c6dec361e541a35339b6414b80 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sat, 7 Mar 2015 16:07:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8A=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=89=88--=E6=B3=A8=E5=86=8C=E6=97=B6=E8=BF=94=E5=9B=9E500?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E3=80=8B=E4=BB=A5=E5=8F=8A=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E9=82=80=E8=AF=B7=E6=97=B6=E9=82=AE=E7=AE=B1=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=20Signed-off-by:=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 2 +- app/controllers/projects_controller.rb | 10 +++++++++- app/views/projects/_invite_members_by_mail.html.erb | 3 +++ app/views/projects/_regested.html.erb | 3 +++ app/views/projects/send_mail_to_member.js.erb | 1 + config/locales/zh.yml | 1 + 6 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 app/views/projects/_regested.html.erb create mode 100644 app/views/projects/send_mail_to_member.js.erb diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 87c028354..2cf404ffb 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -125,7 +125,7 @@ class AccountController < ApplicationController #register_by_email_activation(@user) unless @user.new_record? flash[:notice] = l(:notice_account_register_done) - render action: 'email_valid', locals: {:mail => user.mail} + render action: 'email_valid', locals: {:mail => @user.mail} end when '3' #register_automatically(@user) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 6ab757336..052df384e 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -333,13 +333,21 @@ class ProjectsController < ApplicationController end def send_mail_to_member - unless params[:mail].nil? + + if !params[:mail].nil? && User.find_by_mail(params[:mail].to_s).nil? email = params[:mail] Mailer.send_invite_in_project(email, @project, User.current).deliver + @is_zhuce =false + else + @is_zhuce = true + end + respond_to do |format| + format.js end end #发送邮件邀请新用户 def invite_members_by_mail + @is_zhuce =false respond_to do |format| format.html format.js diff --git a/app/views/projects/_invite_members_by_mail.html.erb b/app/views/projects/_invite_members_by_mail.html.erb index 68ab6fae4..42a36bce0 100644 --- a/app/views/projects/_invite_members_by_mail.html.erb +++ b/app/views/projects/_invite_members_by_mail.html.erb @@ -4,6 +4,9 @@
输入好友邮箱地址,Trustie帮您免费发送!
+<%= l(:notice_registed_success) %>
+<% end %> \ No newline at end of file diff --git a/app/views/projects/send_mail_to_member.js.erb b/app/views/projects/send_mail_to_member.js.erb new file mode 100644 index 000000000..21b097c65 --- /dev/null +++ b/app/views/projects/send_mail_to_member.js.erb @@ -0,0 +1 @@ +$("#is_registed").html("<%= escape_javascript( render :partial => 'regested', locals: {:isregisted => @is_zhuce})%>") \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 2763a59ad..8437557ad 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -181,6 +181,7 @@ zh: notice_successful_create: 创建成功 notice_successful_update: 更新成功 notice_successful_delete: 删除成功 + notice_registed_success: 该邮箱已被注册,请直接邀请注册用户 notice_failed_delete: 删除失败 notice_successful_connection: 连接成功 notice_successful_join: 加入成功