项目邀请添加:姓、名、性别
This commit is contained in:
parent
f082494b28
commit
654ebfca46
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 @@
|
|||
<li>
|
||||
<%= 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);" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= 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);" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= 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);" %>
|
||||
</li>
|
||||
<li>
|
||||
<select class="fb_item_gender fl" id="gender" name="gender"><option value="0">男</option><option value="1">女</option></select>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<a href="#" class="btn_free" onclick="senderEmail($(this));">
|
||||
|
|
|
@ -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: 资源库
|
||||
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Reference in New Issue