Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
cb395a33f7
|
@ -247,9 +247,9 @@ class ProjectsController < ApplicationController
|
||||||
# 1、自动注册
|
# 1、自动注册
|
||||||
# 2、加入项目、创建角色
|
# 2、加入项目、创建角色
|
||||||
# 3、用户得分
|
# 3、用户得分
|
||||||
if params[:email]
|
if params[:mail]
|
||||||
user = User.find_by_mail(params[:email].to_s)
|
Member.create(:role_ids => [4], :user_id => params[:user],:project_id => params[:id])
|
||||||
Member.create(:role_ids => [4], :user_id => user.id,:project_id => @project.id)
|
UserGrade.create(:user_id =>params[:user], :project_id => params[:id])
|
||||||
end
|
end
|
||||||
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
|
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
|
||||||
return
|
return
|
||||||
|
|
|
@ -47,6 +47,18 @@ module AccountHelper
|
||||||
user
|
user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 自动创建一个新用户,但是初始状态是锁定的
|
||||||
|
def automatically_register_lock(user, &block)
|
||||||
|
user.lock
|
||||||
|
user.last_login_on = Time.now
|
||||||
|
if user.save
|
||||||
|
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
|
||||||
|
else
|
||||||
|
yield if block_given?
|
||||||
|
end
|
||||||
|
user
|
||||||
|
end
|
||||||
|
|
||||||
def administrator_manually__register(user, &block)
|
def administrator_manually__register(user, &block)
|
||||||
if user.save
|
if user.save
|
||||||
UserStatus.create(:user_id => user.id ,:changsets_count => 0, :watchers_count => 0)
|
UserStatus.create(:user_id => user.id ,:changsets_count => 0, :watchers_count => 0)
|
||||||
|
|
|
@ -58,14 +58,10 @@ class Mailer < ActionMailer::Base
|
||||||
us = UsersService.new
|
us = UsersService.new
|
||||||
# 自动激活用户
|
# 自动激活用户
|
||||||
user = us.register_auto(login, @email, @password)
|
user = us.register_auto(login, @email, @password)
|
||||||
|
|
||||||
Member.create(:role_ids => [4], :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?
|
||||||
@user = user
|
@user = user
|
||||||
@token = Token.get_token_from_user(user, 'autologin')
|
@token = Token.get_token_from_user(user, 'autologin')
|
||||||
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id,:user => user, :token => @token.value
|
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :user => user.id, :mail => true, :token => @token.value)
|
||||||
)
|
|
||||||
mail :to => email, :subject => @subject
|
mail :to => email, :subject => @subject
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -77,7 +73,7 @@ class Mailer < ActionMailer::Base
|
||||||
@project_name = "#{project.name}"
|
@project_name = "#{project.name}"
|
||||||
@user = user
|
@user = user
|
||||||
@token = Token.get_token_from_user(user, 'autologin')
|
@token = Token.get_token_from_user(user, 'autologin')
|
||||||
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :email => email, :token => @token.value)
|
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :user => user.id, :mail => true, :token => @token.value)
|
||||||
mail :to => email, :subject => @subject
|
mail :to => email, :subject => @subject
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ class Project < ActiveRecord::Base
|
||||||
|
|
||||||
validates_presence_of :name, :identifier
|
validates_presence_of :name, :identifier
|
||||||
validates_uniqueness_of :identifier
|
validates_uniqueness_of :identifier
|
||||||
validates_uniqueness_of :name
|
# validates_uniqueness_of :name
|
||||||
validates_associated :wiki#, :repository
|
validates_associated :wiki#, :repository
|
||||||
# validates_length_of :description, :maximum => 255
|
# validates_length_of :description, :maximum => 255
|
||||||
validates_length_of :name, :maximum => 255
|
validates_length_of :name, :maximum => 255
|
||||||
|
|
|
@ -46,9 +46,7 @@
|
||||||
<%= text_field_tag 'name', params[:name], :size => 30, :onkeyup => 'regexName1();', :width => "125px" %>
|
<%= text_field_tag 'name', params[:name], :size => 30, :onkeyup => 'regexName1();', :width => "125px" %>
|
||||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||||
<%#= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
|
<%#= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
|
||||||
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="padding-top: 7px !important;">
|
<%= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
|
||||||
<%= l(:label_search)%>
|
|
||||||
</a>
|
|
||||||
<br />
|
<br />
|
||||||
<span id="contest_name_span_head"></span>
|
<span id="contest_name_span_head"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
|
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<p>由<a href="javascript:void(0)" class="problem_name"><%= @issue.author %></a>
|
<p>由<a href="javascript:void(0)" class="problem_name"><%= @issue.author %></a>
|
||||||
<% if @issue.created_on != @issue.updated_on %>
|
<%# if @issue.created_on != @issue.updated_on %>
|
||||||
更新于 <%= format_time(@issue.created_on).html_safe %>
|
添加于 <%= format_time(@issue.created_on).html_safe %>
|
||||||
<% else %>
|
<%# else %>
|
||||||
添加于 <%= format_time(@issue.updated_on).html_safe %>
|
<%#= format_time(@issue.updated_on).html_safe %>
|
||||||
<% end %>
|
<%# end %>
|
||||||
</div>
|
</div>
|
||||||
<!--talk_txt end-->
|
<!--talk_txt end-->
|
||||||
<a href="javascript:void(0)" class="talk_edit fr"<%= render :partial => 'action_menu' %></a>
|
<a href="javascript:void(0)" class="talk_edit fr"<%= render :partial => 'action_menu' %></a>
|
||||||
|
|
Loading…
Reference in New Issue