Merge branch 'dev_hjq' of http://repository.trustie.net/xianbo/trustie2 into dev_hjq

This commit is contained in:
ouyangxuhua 2015-09-16 12:40:12 +08:00
commit 30e703b9bf
4 changed files with 21 additions and 7 deletions

View File

@ -357,13 +357,26 @@ class ProjectsController < ApplicationController
end
# 项目邀请用户加入实现过程
# 两种情况1、系统外用户2、系统内用户 (通过邮件判定)
def send_mail_to_member
# 该邮箱未注册过
if !params[:mail].blank? && User.find_by_mail(params[:mail].to_s).nil?
if !User.where("login =?", params[:mail]).first.nil?
# 用户名唯一,如果该邮箱被用户作为用户名使用则跳出
flash[:error] = l(:notice_email_login_used)
# 用户名唯一,用户修改邮箱,未修改用户名,用户名等同邮箱的情况,默认改用户已经注册
user = User.find_by_login(params[:mail].to_s)
if !user.member_of?(@project)
# 如果已经邀请过该用户,则不重复发送
if InviteList.where("project_id =? and mail =?", @project.id, params[:mail].to_s).first.nil?
email = params[:mail]
Mailer.request_member_to_project(email, @project, User.current).deliver
flash[:notice] = l(:notice_email_sent, :value => email)
else
flash[:error] = l(:notice_email_invited)
end
else
flash[:error] = l(:label_member_of_project, :value => email)
end
else
email = params[:mail]
Mailer.send_invite_in_project(email, @project, User.current).deliver
@ -393,7 +406,7 @@ class ProjectsController < ApplicationController
end
end
#发送邮件邀请新用户
# 发送邮件邀请新用户页面对应方法
def invite_members_by_mail
if User.current.member_of?(@project) || User.current.admin?
@inviter_lists = InviteList.where(project_id:@project.id).all
@ -461,9 +474,9 @@ class ProjectsController < ApplicationController
flash[:notice] = l(:label_mail_invite_success)
end
end
# 私有项目非项目成员无法访问成员列表
unless @project.is_public?
return render_403 unless User.current.member_of?(@project)
end
## 有角色参数的才是课程,没有的就是项目
@render_file = 'project_member_list'

View File

@ -4,9 +4,9 @@
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
<span style="float: left; width: 526px">
<p><span style="color:#1b55a7; font-weight:bold;"><%= @invitor_name %></span> 邀请您加入项目:<span style="color:#1b55a7; font-weight:bold;"><%= @project_name %></span> </p>
<p><span style="color:#1b55a7; font-weight:bold;"><%= @invitor_name %></span> 邀请您加入项目:<span style="color:#1b55a7; font-weight:bold;"><%=link_to @project_name, project_url(@project) %></span> </p>
<div class="cl" style="margin-top: 30px; clear:both; overflow:hidden;"></div>
<p>点击“同意加入”按钮,即可快速加入项目!</p> <br/>
<p>点击“同意加入”按钮,即可快速加入项目,查看项目相关信息</p> <br/>
<label class="mail_reply">
<%= link_to( l(:label_agree_join_project), @project_url, :class => "mail_reply", :style =>'display:block; float:right; width:80px; text-align:center; height:30px; background:#15bccf; color:#fff; font-weight:normal; font-size:14px; line-height: 30px;') %>
</label>

View File

@ -9,6 +9,7 @@
<p> <%= link_to @project_url, @project_url%></p>
<p>您的账号为:<%= @email %></p>
<p>密码为: <%= @password %></p>
<p style="color: red;font-size: 12px;">为了您的账号安全,请勿将邮件信息告知他人!</p>
</span>
</li>

View File

@ -52,7 +52,7 @@ zh:
notice_not_authorized_archived_project: 要访问的项目已经归档。
notice_not_authorized_message: 您访问的消息不存在!
notice_email_sent: "邮件已发送至 %{value}"
notice_email_login_used: 无法自动为该邮箱注册新用户,该邮箱地址已经有人作为登录名使用,您可以通过平台的注册功能为该用户注册账号
notice_email_login_used: 无法自动为该邮箱注册新用户,该邮箱地址已经有人作为登录名使用
notice_email_invited: 已经向该邮箱发送过邀请,正在等待对方的回复!
notice_email_error: "发送邮件时发生错误 (%{value})"
notice_feeds_access_key_reseted: 您的RSS存取键已被重置。