缺陷上传附件显示

项目邮件邀(未完成,需切换分支)
This commit is contained in:
huang 2015-04-22 16:49:07 +08:00
parent f6dd7ff652
commit 681546b860
4 changed files with 13 additions and 7 deletions

View File

@ -243,8 +243,10 @@ class ProjectsController < ApplicationController
# Author lizanle # Author lizanle
# Description 项目动态展示方法,删除了不必要的代码 # Description 项目动态展示方法,删除了不必要的代码
def show def show
# params[:login]为邮箱邀请用户加入,主要功能:
# 试图跳转到请求的按钮 # 1、自动注册
# 2、加入项目、创建角色
# 3、用户得分
if params[:login] if params[:login]
login = params[:login] login = params[:login]
login = login.sub(/%40/,'@') login = login.sub(/%40/,'@')
@ -252,6 +254,7 @@ class ProjectsController < ApplicationController
password = params[:password] password = params[:password]
us = UsersService.new us = UsersService.new
user = us.register_auto(login,mail, password) user = us.register_auto(login,mail, password)
Member.create(:role_ids => [4], :user_id => user.id,:project_id => @project.id) Member.create(:role_ids => [4], :user_id => user.id,:project_id => @project.id)
UserGrade.create(:user_id => user.id, :project_id => @project.id) UserGrade.create(:user_id => user.id, :project_id => @project.id)
User.current = user unless User.current.nil? User.current = user unless User.current.nil?

View File

@ -53,7 +53,8 @@ class Mailer < ActionMailer::Base
@subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} " @subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} "
@password = newpass(6) @password = newpass(6)
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, @project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id,
:password => @password, :login => email) :password => @password,
:login => email)
mail :to => email, :subject => @subject mail :to => email, :subject => @subject
end end

View File

@ -44,13 +44,16 @@ class UsersService
#location = get_user_location @user #location = get_user_location @user
#{:id => @user.id, :img_url => img_url, :nickname => @user.login, :gender => gender, :work_unit => work_unit, :mail => @user.mail, :location => location, :brief_introduction => @user.user_extensions.brief_introduction} #{:id => @user.id, :img_url => img_url, :nickname => @user.login, :gender => gender, :work_unit => work_unit, :mail => @user.mail, :location => location, :brief_introduction => @user.user_extensions.brief_introduction}
end end
# 自动注册功能 FOR邮件邀请
def register_auto(login,mail,password) def register_auto(login,mail,password)
@user = User.new @user = User.new
@user.admin = false @user.admin = false
@user.register @user.register
@user.login = login @user.login = login
@user.mail =mail @user.mail = mail
password_confirmation = password password_confirmation = password
# 自动注册,跳过代码验证
should_confirmation_password = true should_confirmation_password = true
if !password.blank? && !password_confirmation.blank? && should_confirmation_password if !password.blank? && !password_confirmation.blank? && should_confirmation_password
@user.password, @user.password_confirmation = password, password_confirmation @user.password, @user.password_confirmation = password, password_confirmation
@ -59,9 +62,7 @@ class UsersService
else else
@user.password = "" @user.password = ""
end end
@user = automatically_register(@user) @user = automatically_register(@user)
if @user.id != nil if @user.id != nil
ue = @user.user_extensions ||= UserExtensions.new ue = @user.user_extensions ||= UserExtensions.new
ue.user_id = @user.id ue.user_id = @user.id
@ -69,6 +70,7 @@ class UsersService
end end
@user @user
end end
#显示用户 #显示用户
#id用户id #id用户id
def show_user(params) def show_user(params)

View File

@ -64,7 +64,7 @@
<% images = attachments.select(&:thumbnailable?) %> <% images = attachments.select(&:thumbnailable?) %>
<% if images.any? %> <% if images.any? %>
<% images.each do |attachment| %> <% images.each do |attachment| %>
<div class="pro_pic fl "><%= thumbnail_issue_tag(attachment) %></div> <div class="pro_pic fl " width="100" height="73"><%= thumbnail_issue_tag(attachment) %></div>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>