邮件邀请用户

This commit is contained in:
whimlex 2015-03-12 18:04:12 +08:00
parent 18422ecf6a
commit 28321deeb5
2 changed files with 25 additions and 14 deletions

View File

@ -338,12 +338,12 @@ class ProjectsController < ApplicationController
email = params[:mail]
Mailer.send_invite_in_project(email, @project, User.current).deliver
@is_zhuce =false
flash[:notice] = l(:notice_successful_update)
flash[:notice] = l(:notice_email_sent, :value => email)
else
@is_zhuce = true
end
respond_to do |format|
format.js
format.html{redirect_to invite_members_by_mail_project_url(@project)}
end
end
#发送邮件邀请新用户

View File

@ -1,16 +1,26 @@
<script>
function verifyAddress(obj) {
var email = document.getElementsByName('mail');
function verifyAddress() {
var email = $('#mail').val();
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(email.value)&& !(email.value == null)) return true;
else
{
document.getElementById('valid_email').innerHTML = "您所填写的电子邮件格式不正确";
document.getElementById('valid_email').style.color = "#FF0000";
return false;
}
if (email == "" || filter.test(email)) {
$("#valid_email").html("");
}
else
{
$("#valid_email").html("您所填写的电子邮件格式不正确");
}
}
// if (filter.test(email)&& !(email.value == null)) return true;
// else
// {
// document.getElementById('valid_email').innerHTML = "您所填写的电子邮件格式不正确";
// document.getElementById('valid_email').style.color = "#FF0000";
// return false;
// }
//
// }
</script>
<div class="project_r_h">
<h2 class="project_h2">邀请加入</h2>
@ -28,8 +38,9 @@
<div id="is_registed">
<%= render :partial => 'regested', locals: { :isregisted => false} %>
</div>
<%= form_tag('send_mail_to_member', :controller => 'projects',:action => 'send_mail_to_member', method: 'get',:remote=>true) do %>
<%= text_field_tag 'mail', '', :class => "fb_item fl", :placeholder => l(:label_input_email) %>
<%= form_tag('send_mail_to_member', :controller => 'projects',:action => 'send_mail_to_member', method: 'get') do %>
<span id="valid_email" style="color: #FF0000;"></span>
<%= text_field_tag 'mail', '', :class => "fb_item fl", :placeholder => l(:label_input_email), :onblur => "verifyAddress();" %>
<div class="cl"></div>
<div class="cl"></div>
<a href="#" class="btn_free" onclick="$(this).parent().submit();">