From d06a1a7fa47a2c3b02e9d97034e6acaf2dc5a01d Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Wed, 29 Sep 2010 16:00:45 +0000 Subject: [PATCH] Refactor: rename UsersController#add to #new git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4229 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/users_controller.rb | 6 +++--- app/views/users/index.rhtml | 2 +- app/views/users/{add.rhtml => new.html.erb} | 0 config/routes.rb | 3 +-- test/functional/users_controller_test.rb | 8 ++++---- test/integration/admin_test.rb | 4 ++-- test/integration/routing_test.rb | 2 +- 7 files changed, 12 insertions(+), 13 deletions(-) rename app/views/users/{add.rhtml => new.html.erb} (100%) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 3fb11103d66..1fd8347b7a8 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -71,7 +71,7 @@ def show render_404 end - def add + def new @notification_options = User::MAIL_NOTIFICATION_OPTIONS @notification_option = Setting.default_notification_option @@ -100,14 +100,14 @@ def create 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 diff --git a/app/views/users/index.rhtml b/app/views/users/index.rhtml index 1b4702872e0..804678959a0 100644 --- a/app/views/users/index.rhtml +++ b/app/views/users/index.rhtml @@ -1,5 +1,5 @@
-<%= link_to l(:label_user_new), {:action => 'add'}, :class => 'icon icon-add' %> +<%= link_to l(:label_user_new), {:action => 'new'}, :class => 'icon icon-add' %>

<%=l(:label_user_plural)%>

diff --git a/app/views/users/add.rhtml b/app/views/users/new.html.erb similarity index 100% rename from app/views/users/add.rhtml rename to app/views/users/new.html.erb diff --git a/config/routes.rb b/config/routes.rb index 0e60c555fc9..d9c22d6cc71 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -143,11 +143,10 @@ 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' diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index 6131c7e7dd0..577f54b0771 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.rb @@ -107,14 +107,14 @@ def test_show_displays_memberships_based_on_project_visibility 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 @@ def test_show_displays_memberships_based_on_project_visibility should_assign_to :user should_respond_with :success - should_render_template :add + should_render_template :new end end diff --git a/test/integration/admin_test.rb b/test/integration/admin_test.rb index 62ddc533f56..dd52859cfbf 100644 --- a/test/integration/admin_test.rb +++ b/test/integration/admin_test.rb @@ -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") diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index 74b7d990dd3..341efe3cd1f 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.rb @@ -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'