diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 65f346d5f..376034097 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -20,9 +20,9 @@ class ProjectsController < ApplicationController menu_item :roadmap, :only => :roadmap menu_item :settings, :only => :settings - before_filter :find_project, :except => [ :index, :list, :add, :create, :copy ] - before_filter :authorize, :except => [ :index, :list, :add, :create, :copy, :archive, :unarchive, :destroy] - before_filter :authorize_global, :only => [:add, :create] + before_filter :find_project, :except => [ :index, :list, :new, :create, :copy ] + before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy] + before_filter :authorize_global, :only => [:new, :create] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ] accept_key_auth :index @@ -60,8 +60,7 @@ class ProjectsController < ApplicationController end end - # Add a new project - def add + def new @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position") @trackers = Tracker.all @project = Project.new(params[:project]) @@ -95,7 +94,7 @@ class ProjectsController < ApplicationController end else respond_to do |format| - format.html { render :action => 'add' } + format.html { render :action => 'new' } format.xml { render :xml => @project.errors, :status => :unprocessable_entity } end end diff --git a/app/views/admin/projects.rhtml b/app/views/admin/projects.rhtml index 46b68e4cc..b37fec57b 100644 --- a/app/views/admin/projects.rhtml +++ b/app/views/admin/projects.rhtml @@ -1,5 +1,5 @@
-<%= link_to l(:label_project_new), {:controller => 'projects', :action => 'add'}, :class => 'icon icon-add' %> +<%= link_to l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add' %>

<%=l(:label_project_plural)%>

diff --git a/app/views/projects/index.rhtml b/app/views/projects/index.rhtml index a2ba1c389..2b506388a 100644 --- a/app/views/projects/index.rhtml +++ b/app/views/projects/index.rhtml @@ -3,7 +3,7 @@ <% end %>
- <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'add'}, :class => 'icon icon-add') + ' |' if User.current.allowed_to?(:add_project, nil, :global => true) %> + <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') + ' |' if User.current.allowed_to?(:add_project, nil, :global => true) %> <%= link_to(l(:label_issue_view_all), { :controller => 'issues' }) + ' |' if User.current.allowed_to?(:view_issues, nil, :global => true) %> <%= link_to(l(:label_overall_spent_time), { :controller => 'time_entries' }) + ' |' if User.current.allowed_to?(:view_time_entries, nil, :global => true) %> <%= link_to l(:label_overall_activity), { :controller => 'activities', :action => 'index' }%> diff --git a/app/views/projects/add.rhtml b/app/views/projects/new.html.erb similarity index 100% rename from app/views/projects/add.rhtml rename to app/views/projects/new.html.erb diff --git a/config/routes.rb b/config/routes.rb index 8bcdd91d6..7f971da7c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -177,7 +177,7 @@ ActionController::Routing::Routes.draw do |map| projects.with_options :conditions => {:method => :get} do |project_views| project_views.connect 'projects', :action => 'index' project_views.connect 'projects.:format', :action => 'index' - project_views.connect 'projects/new', :action => 'add' + project_views.connect 'projects/new', :action => 'new' project_views.connect 'projects/:id', :action => 'show' project_views.connect 'projects/:id.:format', :action => 'show' project_views.connect 'projects/:id/:action', :action => /destroy|settings/ diff --git a/lib/redmine.rb b/lib/redmine.rb index aa15770db..dcddeb902 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -46,12 +46,12 @@ end Redmine::AccessControl.map do |map| map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true map.permission :search_project, {:search => :index}, :public => true - map.permission :add_project, {:projects => [:add, :create]}, :require => :loggedin + map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin map.permission :edit_project, {:projects => [:settings, :edit]}, :require => :member map.permission :select_project_modules, {:projects => :modules}, :require => :member map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member map.permission :manage_versions, {:projects => :settings, :versions => [:new, :edit, :close_completed, :destroy]}, :require => :member - map.permission :add_subprojects, {:projects => [:add, :create]}, :require => :member + map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member map.project_module :issue_tracking do |map| # Issue categories diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 6b8c84728..e661ca29e 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -87,16 +87,16 @@ class ProjectsControllerTest < ActionController::TestCase end end - context "#add" do + context "#new" do context "by admin user" do setup do @request.session[:user_id] = 1 end should "accept get" do - get :add + get :new assert_response :success - assert_template 'add' + assert_template 'new' end end @@ -108,9 +108,9 @@ class ProjectsControllerTest < ActionController::TestCase end should "accept get" do - get :add + get :new assert_response :success - assert_template 'add' + assert_template 'new' assert_no_tag :select, :attributes => {:name => 'project[parent_id]'} end end @@ -123,9 +123,9 @@ class ProjectsControllerTest < ActionController::TestCase end should "accept get" do - get :add, :parent_id => 'ecookbook' + get :new, :parent_id => 'ecookbook' assert_response :success - assert_template 'add' + assert_template 'new' # parent project selected assert_tag :select, :attributes => {:name => 'project[parent_id]'}, :child => {:tag => 'option', :attributes => {:value => '1', :selected => 'selected'}} diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index e75cf4721..f43dc8a61 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.rb @@ -166,7 +166,7 @@ class RoutingTest < ActionController::IntegrationTest should_route :get, "/projects", :controller => 'projects', :action => 'index' should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom' should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml' - should_route :get, "/projects/new", :controller => 'projects', :action => 'add' + should_route :get, "/projects/new", :controller => 'projects', :action => 'new' should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test' should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml' should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223'