Refactor: rename UsersController#add to #new
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4229 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
4853dd97fd
commit
d06a1a7fa4
|
@ -71,7 +71,7 @@ class UsersController < ApplicationController
|
||||||
render_404
|
render_404
|
||||||
end
|
end
|
||||||
|
|
||||||
def add
|
def new
|
||||||
@notification_options = User::MAIL_NOTIFICATION_OPTIONS
|
@notification_options = User::MAIL_NOTIFICATION_OPTIONS
|
||||||
@notification_option = Setting.default_notification_option
|
@notification_option = Setting.default_notification_option
|
||||||
|
|
||||||
|
@ -100,14 +100,14 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
Mailer.deliver_account_information(@user, params[:password]) if params[:send_information]
|
Mailer.deliver_account_information(@user, params[:password]) if params[:send_information]
|
||||||
flash[:notice] = l(:notice_successful_create)
|
flash[:notice] = l(:notice_successful_create)
|
||||||
redirect_to(params[:continue] ? {:controller => 'users', :action => 'add'} :
|
redirect_to(params[:continue] ? {:controller => 'users', :action => 'new'} :
|
||||||
{:controller => 'users', :action => 'edit', :id => @user})
|
{:controller => 'users', :action => 'edit', :id => @user})
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
@auth_sources = AuthSource.find(:all)
|
@auth_sources = AuthSource.find(:all)
|
||||||
@notification_option = @user.mail_notification
|
@notification_option = @user.mail_notification
|
||||||
|
|
||||||
render :action => 'add'
|
render :action => 'new'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="contextual">
|
<div class="contextual">
|
||||||
<%= link_to l(:label_user_new), {:action => 'add'}, :class => 'icon icon-add' %>
|
<%= link_to l(:label_user_new), {:action => 'new'}, :class => 'icon icon-add' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2><%=l(:label_user_plural)%></h2>
|
<h2><%=l(:label_user_plural)%></h2>
|
||||||
|
|
|
@ -143,11 +143,10 @@ ActionController::Routing::Routes.draw do |map|
|
||||||
users.with_options :conditions => {:method => :get} do |user_views|
|
users.with_options :conditions => {:method => :get} do |user_views|
|
||||||
user_views.connect 'users', :action => 'index'
|
user_views.connect 'users', :action => 'index'
|
||||||
user_views.connect 'users/:id', :action => 'show', :id => /\d+/
|
user_views.connect 'users/:id', :action => 'show', :id => /\d+/
|
||||||
user_views.connect 'users/new', :action => 'add'
|
user_views.connect 'users/new', :action => 'new'
|
||||||
user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil
|
user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil
|
||||||
end
|
end
|
||||||
users.with_options :conditions => {:method => :post} do |user_actions|
|
users.with_options :conditions => {:method => :post} do |user_actions|
|
||||||
user_actions.connect 'users', :action => 'add'
|
|
||||||
user_actions.connect 'users/new', :action => 'create'
|
user_actions.connect 'users/new', :action => 'create'
|
||||||
user_actions.connect 'users/:id/edit', :action => 'edit'
|
user_actions.connect 'users/:id/edit', :action => 'edit'
|
||||||
user_actions.connect 'users/:id/memberships', :action => 'edit_membership'
|
user_actions.connect 'users/:id/memberships', :action => 'edit_membership'
|
||||||
|
|
|
@ -107,14 +107,14 @@ class UsersControllerTest < ActionController::TestCase
|
||||||
assert project_ids.include?(2) #private project admin can see
|
assert project_ids.include?(2) #private project admin can see
|
||||||
end
|
end
|
||||||
|
|
||||||
context "GET :add" do
|
context "GET :new" do
|
||||||
setup do
|
setup do
|
||||||
get :add
|
get :new
|
||||||
end
|
end
|
||||||
|
|
||||||
should_assign_to :user
|
should_assign_to :user
|
||||||
should_respond_with :success
|
should_respond_with :success
|
||||||
should_render_template :add
|
should_render_template :new
|
||||||
end
|
end
|
||||||
|
|
||||||
context "POST :create" do
|
context "POST :create" do
|
||||||
|
@ -148,7 +148,7 @@ class UsersControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
should_assign_to :user
|
should_assign_to :user
|
||||||
should_respond_with :success
|
should_respond_with :success
|
||||||
should_render_template :add
|
should_render_template :new
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,9 +22,9 @@ class AdminTest < ActionController::IntegrationTest
|
||||||
|
|
||||||
def test_add_user
|
def test_add_user
|
||||||
log_user("admin", "admin")
|
log_user("admin", "admin")
|
||||||
get "/users/add"
|
get "/users/new"
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template "users/add"
|
assert_template "users/new"
|
||||||
post "/users/create", :user => { :login => "psmith", :firstname => "Paul", :lastname => "Smith", :mail => "psmith@somenet.foo", :language => "en" }, :password => "psmith09", :password_confirmation => "psmith09"
|
post "/users/create", :user => { :login => "psmith", :firstname => "Paul", :lastname => "Smith", :mail => "psmith@somenet.foo", :language => "en" }, :password => "psmith09", :password_confirmation => "psmith09"
|
||||||
|
|
||||||
user = User.find_by_login("psmith")
|
user = User.find_by_login("psmith")
|
||||||
|
|
|
@ -246,7 +246,7 @@ class RoutingTest < ActionController::IntegrationTest
|
||||||
context "users" do
|
context "users" do
|
||||||
should_route :get, "/users", :controller => 'users', :action => 'index'
|
should_route :get, "/users", :controller => 'users', :action => 'index'
|
||||||
should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44'
|
should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44'
|
||||||
should_route :get, "/users/new", :controller => 'users', :action => 'add'
|
should_route :get, "/users/new", :controller => 'users', :action => 'new'
|
||||||
should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
|
should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
|
||||||
should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership'
|
should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue