diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 251c47d4c..a8a302045 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -382,7 +382,10 @@ class ProjectsController < ApplicationController end else email = params[:mail] - Mailer.send_invite_in_project(email, @project, User.current).deliver + first_name = params[:first_name] + last_name = params[:last_name] + gender = params[:gender] + Mailer.send_invite_in_project(email, @project, User.current, first_name, last_name, gender).deliver @is_zhuce = false flash[:notice] = l(:notice_email_sent, :value => email) end diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 39e709beb..d797f1ce1 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -107,7 +107,7 @@ class Mailer < ActionMailer::Base # author: alan # 邀请未注册用户加入项目 # 功能: 在加入项目的同时自动注册用户 - def send_invite_in_project(email, project, invitor) + def send_invite_in_project(email, project, invitor, first_name, last_name, gender) @email = email @subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} " @password = newpass(6) @@ -116,7 +116,7 @@ class Mailer < ActionMailer::Base login = login.sub(/%40/,'@') us = UsersService.new # 自动激活用户 - user = us.register_auto(login, email, @password) + user = us.register_auto(login, email, @password, first_name, last_name, gender) InviteList.create(:user_id => user.id, :project_id => project.id, :mail =>email) User.current = user unless User.current.nil? @user = user diff --git a/app/services/users_service.rb b/app/services/users_service.rb index 7e8e775ed..236dbc731 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -47,12 +47,16 @@ class UsersService end # 自动注册功能 FOR:邮件邀请 - def register_auto(login,mail,password) + def register_auto(login, mail, password, first_name, last_name, gender) + mail_notification = "day" @user = User.new @user.admin = false @user.register @user.login = login @user.mail = mail + @user.firstname = first_name + @user.lastname = last_name + @user.mail_notification = mail_notification password_confirmation = password should_confirmation_password = true if !password.blank? && !password_confirmation.blank? && should_confirmation_password @@ -65,6 +69,7 @@ class UsersService @user = automatically_register_lock(@user) if @user.id != nil ue = @user.user_extensions ||= UserExtensions.new + ue.gender = gender ue.user_id = @user.id ue.save end diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb index 44c571422..a697b70a4 100644 --- a/app/views/projects/invite_members_by_mail.html.erb +++ b/app/views/projects/invite_members_by_mail.html.erb @@ -44,6 +44,36 @@ } + function verifyFirstName() { + var first_name = $.trim($('#first_name').val()); + if(first_name.length > 30) + { + $("#valid_email").text("用户名字过长,最长为30个字符"); + return false; + } + else + { + $("#valid_email").text(""); + return true; + } + + } + + function verifyLastName() { + var last_name = $.trim($('#last_name').val()); + if(last_name.length > 30) + { + $("#valid_email").text("用户姓氏过长,最长为30个字符"); + return false; + } + else + { + $("#valid_email").text(""); + return true; + } + + } + function senderEmail(obj) { if(verifyAddress()) @@ -79,6 +109,15 @@
  • <%= text_field_tag 'mail', '', :class => "fb_item fl", :placeholder => l(:label_input_email), :onkeyup => "this.value=this.value.replace(' ','')", :style => "ime-mode:disabled;", :onblur => "verifyAddress(this);" %>
  • +
  • + <%= text_field_tag 'first_name', '', :class => "fb_item_first_name fl", :placeholder => l(:label_input_email_lastname), :onkeyup => "this.value=this.value.replace(' ','')", :style => "ime-mode:disabled;", :onblur => "verifyLastName(this);" %> +
  • +
  • + <%= text_field_tag 'last_name', '', :class => "fb_item_last_name fl", :placeholder => l(:label_input_email_firstname), :onkeyup => "this.value=this.value.replace(' ','')", :style => "ime-mode:disabled;", :onblur => "verifyFirstName(this);" %> +
  • +
  • + +
  • diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 69288d933..195526712 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2024,7 +2024,11 @@ zh: label_end_time: 截止时间 label_send_email: 确定发送 - label_input_email: 请输入邮箱地址 + label_input_email: 请输入邮箱地址(必填) + label_input_email_firstname: 请输入用户名字(非必填) + label_input_email_lastname: 请输入用户姓氏(非必填) + label_input_email_gender: 请输入用户性别 + #api end project_module_files: 资源库 diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index f769ff9e6..0a78b399b 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -44,7 +44,10 @@ a:hover.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;} .box_main02{ width:390px; margin:15px auto;} .box_h3{ color:#15bccf; font-size:16px;} .box_p{ color:#404040; margin-bottom:5px;} -.fb_item{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:5px; padding-left:5px; width:290px;} +.fb_item{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:5px; padding-left:5px; width:200px;} +.fb_item_first_name{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:5px; padding-left:5px; width:150px;margin-left: 10px;} +.fb_item_last_name{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:5px; padding-left:5px; width:150px;margin-left: 10px;} +.fb_item_gender{ color:#919191; border:1px solid #919191; height:29px; margin-bottom:5px; padding-left:5px; width:48px;margin-left: 10px;} a.icon_addm{ background:url(../images/img_floatbox.png) 0 -33px no-repeat; width:16px; height:16px; display:block; margin:5px 0 0 5px;} a:hover.icon_addm{background:url(../images/img_floatbox.png) 0 -61px no-repeat; } a.icon_removem{ background:url(../images/img_floatbox.png) -22px -33px no-repeat;width:16px; height:16px; display:block; margin:5px 0 0 5px}