From f219a92c1fa0fad0fb30db460b7556296cf459a6 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Mon, 20 Sep 2010 03:59:50 +0000 Subject: [PATCH] Merged r4069 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.0-stable@4139 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/projects_controller.rb | 11 +++++------ app/views/admin/projects.rhtml | 2 +- app/views/projects/index.rhtml | 2 +- app/views/projects/{add.rhtml => new.html.erb} | 0 config/routes.rb | 2 +- lib/redmine.rb | 4 ++-- test/functional/projects_controller_test.rb | 14 +++++++------- test/integration/routing_test.rb | 2 +- 8 files changed, 18 insertions(+), 19 deletions(-) rename app/views/projects/{add.rhtml => new.html.erb} (100%) 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 84742ab60..151ca25e5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -196,7 +196,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 ac287971f..8078f57bc 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 c8c4a2984..d82eadaf2 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' -- 2.39.5