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:
Eric Davis 2010-09-29 16:00:45 +00:00
parent 4853dd97fd
commit d06a1a7fa4
7 changed files with 12 additions and 13 deletions

View File

@ -71,7 +71,7 @@ class UsersController < ApplicationController
render_404
end
def add
def new
@notification_options = User::MAIL_NOTIFICATION_OPTIONS
@notification_option = Setting.default_notification_option
@ -100,14 +100,14 @@ class UsersController < ApplicationController
Mailer.deliver_account_information(@user, params[:password]) if params[:send_information]
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})
return
else
@auth_sources = AuthSource.find(:all)
@notification_option = @user.mail_notification
render :action => 'add'
render :action => 'new'
end
end

View File

@ -1,5 +1,5 @@
<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>
<h2><%=l(:label_user_plural)%></h2>

View File

@ -143,11 +143,10 @@ ActionController::Routing::Routes.draw do |map|
users.with_options :conditions => {:method => :get} do |user_views|
user_views.connect 'users', :action => 'index'
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
end
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/:id/edit', :action => 'edit'
user_actions.connect 'users/:id/memberships', :action => 'edit_membership'

View File

@ -107,14 +107,14 @@ class UsersControllerTest < ActionController::TestCase
assert project_ids.include?(2) #private project admin can see
end
context "GET :add" do
context "GET :new" do
setup do
get :add
get :new
end
should_assign_to :user
should_respond_with :success
should_render_template :add
should_render_template :new
end
context "POST :create" do
@ -148,7 +148,7 @@ class UsersControllerTest < ActionController::TestCase
should_assign_to :user
should_respond_with :success
should_render_template :add
should_render_template :new
end
end

View File

@ -22,9 +22,9 @@ class AdminTest < ActionController::IntegrationTest
def test_add_user
log_user("admin", "admin")
get "/users/add"
get "/users/new"
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"
user = User.find_by_login("psmith")

View File

@ -246,7 +246,7 @@ class RoutingTest < ActionController::IntegrationTest
context "users" do
should_route :get, "/users", :controller => 'users', :action => 'index'
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/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership'