@@ -20,9 +20,9 class ProjectsController < ApplicationController | |||||
20 | menu_item :roadmap, :only => :roadmap |
|
20 | menu_item :roadmap, :only => :roadmap | |
21 | menu_item :settings, :only => :settings |
|
21 | menu_item :settings, :only => :settings | |
22 |
|
22 | |||
23 |
before_filter :find_project, :except => [ :index, :list, : |
|
23 | before_filter :find_project, :except => [ :index, :list, :new, :create, :copy ] | |
24 |
before_filter :authorize, :except => [ :index, :list, : |
|
24 | before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy] | |
25 |
before_filter :authorize_global, :only => [: |
|
25 | before_filter :authorize_global, :only => [:new, :create] | |
26 | before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ] |
|
26 | before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ] | |
27 | accept_key_auth :index |
|
27 | accept_key_auth :index | |
28 |
|
28 | |||
@@ -60,8 +60,7 class ProjectsController < ApplicationController | |||||
60 | end |
|
60 | end | |
61 | end |
|
61 | end | |
62 |
|
62 | |||
63 | # Add a new project |
|
63 | def new | |
64 | def add |
|
|||
65 | @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position") |
|
64 | @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position") | |
66 | @trackers = Tracker.all |
|
65 | @trackers = Tracker.all | |
67 | @project = Project.new(params[:project]) |
|
66 | @project = Project.new(params[:project]) | |
@@ -95,7 +94,7 class ProjectsController < ApplicationController | |||||
95 | end |
|
94 | end | |
96 | else |
|
95 | else | |
97 | respond_to do |format| |
|
96 | respond_to do |format| | |
98 |
format.html { render :action => ' |
|
97 | format.html { render :action => 'new' } | |
99 | format.xml { render :xml => @project.errors, :status => :unprocessable_entity } |
|
98 | format.xml { render :xml => @project.errors, :status => :unprocessable_entity } | |
100 | end |
|
99 | end | |
101 | end |
|
100 | end |
@@ -1,5 +1,5 | |||||
1 | <div class="contextual"> |
|
1 | <div class="contextual"> | |
2 |
<%= link_to l(:label_project_new), {:controller => 'projects', :action => ' |
|
2 | <%= link_to l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add' %> | |
3 | </div> |
|
3 | </div> | |
4 |
|
4 | |||
5 | <h2><%=l(:label_project_plural)%></h2> |
|
5 | <h2><%=l(:label_project_plural)%></h2> |
@@ -3,7 +3,7 | |||||
3 | <% end %> |
|
3 | <% end %> | |
4 |
|
4 | |||
5 | <div class="contextual"> |
|
5 | <div class="contextual"> | |
6 |
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => ' |
|
6 | <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') + ' |' if User.current.allowed_to?(:add_project, nil, :global => true) %> | |
7 | <%= link_to(l(:label_issue_view_all), { :controller => 'issues' }) + ' |' if User.current.allowed_to?(:view_issues, nil, :global => true) %> |
|
7 | <%= link_to(l(:label_issue_view_all), { :controller => 'issues' }) + ' |' if User.current.allowed_to?(:view_issues, nil, :global => true) %> | |
8 | <%= link_to(l(:label_overall_spent_time), { :controller => 'time_entries' }) + ' |' if User.current.allowed_to?(:view_time_entries, nil, :global => true) %> |
|
8 | <%= link_to(l(:label_overall_spent_time), { :controller => 'time_entries' }) + ' |' if User.current.allowed_to?(:view_time_entries, nil, :global => true) %> | |
9 | <%= link_to l(:label_overall_activity), { :controller => 'activities', :action => 'index' }%> |
|
9 | <%= link_to l(:label_overall_activity), { :controller => 'activities', :action => 'index' }%> |
1 | NO CONTENT: file renamed from app/views/projects/add.rhtml to app/views/projects/new.html.erb |
|
NO CONTENT: file renamed from app/views/projects/add.rhtml to app/views/projects/new.html.erb |
@@ -196,7 +196,7 ActionController::Routing::Routes.draw do |map| | |||||
196 | projects.with_options :conditions => {:method => :get} do |project_views| |
|
196 | projects.with_options :conditions => {:method => :get} do |project_views| | |
197 | project_views.connect 'projects', :action => 'index' |
|
197 | project_views.connect 'projects', :action => 'index' | |
198 | project_views.connect 'projects.:format', :action => 'index' |
|
198 | project_views.connect 'projects.:format', :action => 'index' | |
199 |
project_views.connect 'projects/new', :action => ' |
|
199 | project_views.connect 'projects/new', :action => 'new' | |
200 | project_views.connect 'projects/:id', :action => 'show' |
|
200 | project_views.connect 'projects/:id', :action => 'show' | |
201 | project_views.connect 'projects/:id.:format', :action => 'show' |
|
201 | project_views.connect 'projects/:id.:format', :action => 'show' | |
202 | project_views.connect 'projects/:id/:action', :action => /destroy|settings/ |
|
202 | project_views.connect 'projects/:id/:action', :action => /destroy|settings/ |
@@ -46,12 +46,12 end | |||||
46 | Redmine::AccessControl.map do |map| |
|
46 | Redmine::AccessControl.map do |map| | |
47 | map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true |
|
47 | map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true | |
48 | map.permission :search_project, {:search => :index}, :public => true |
|
48 | map.permission :search_project, {:search => :index}, :public => true | |
49 |
map.permission :add_project, {:projects => [: |
|
49 | map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin | |
50 | map.permission :edit_project, {:projects => [:settings, :edit]}, :require => :member |
|
50 | map.permission :edit_project, {:projects => [:settings, :edit]}, :require => :member | |
51 | map.permission :select_project_modules, {:projects => :modules}, :require => :member |
|
51 | map.permission :select_project_modules, {:projects => :modules}, :require => :member | |
52 | map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member |
|
52 | map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member | |
53 | map.permission :manage_versions, {:projects => :settings, :versions => [:new, :edit, :close_completed, :destroy]}, :require => :member |
|
53 | map.permission :manage_versions, {:projects => :settings, :versions => [:new, :edit, :close_completed, :destroy]}, :require => :member | |
54 |
map.permission :add_subprojects, {:projects => [: |
|
54 | map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member | |
55 |
|
55 | |||
56 | map.project_module :issue_tracking do |map| |
|
56 | map.project_module :issue_tracking do |map| | |
57 | # Issue categories |
|
57 | # Issue categories |
@@ -87,16 +87,16 class ProjectsControllerTest < ActionController::TestCase | |||||
87 | end |
|
87 | end | |
88 | end |
|
88 | end | |
89 |
|
89 | |||
90 |
context "# |
|
90 | context "#new" do | |
91 | context "by admin user" do |
|
91 | context "by admin user" do | |
92 | setup do |
|
92 | setup do | |
93 | @request.session[:user_id] = 1 |
|
93 | @request.session[:user_id] = 1 | |
94 | end |
|
94 | end | |
95 |
|
95 | |||
96 | should "accept get" do |
|
96 | should "accept get" do | |
97 |
get : |
|
97 | get :new | |
98 | assert_response :success |
|
98 | assert_response :success | |
99 |
assert_template ' |
|
99 | assert_template 'new' | |
100 | end |
|
100 | end | |
101 |
|
101 | |||
102 | end |
|
102 | end | |
@@ -108,9 +108,9 class ProjectsControllerTest < ActionController::TestCase | |||||
108 | end |
|
108 | end | |
109 |
|
109 | |||
110 | should "accept get" do |
|
110 | should "accept get" do | |
111 |
get : |
|
111 | get :new | |
112 | assert_response :success |
|
112 | assert_response :success | |
113 |
assert_template ' |
|
113 | assert_template 'new' | |
114 | assert_no_tag :select, :attributes => {:name => 'project[parent_id]'} |
|
114 | assert_no_tag :select, :attributes => {:name => 'project[parent_id]'} | |
115 | end |
|
115 | end | |
116 | end |
|
116 | end | |
@@ -123,9 +123,9 class ProjectsControllerTest < ActionController::TestCase | |||||
123 | end |
|
123 | end | |
124 |
|
124 | |||
125 | should "accept get" do |
|
125 | should "accept get" do | |
126 |
get : |
|
126 | get :new, :parent_id => 'ecookbook' | |
127 | assert_response :success |
|
127 | assert_response :success | |
128 |
assert_template ' |
|
128 | assert_template 'new' | |
129 | # parent project selected |
|
129 | # parent project selected | |
130 | assert_tag :select, :attributes => {:name => 'project[parent_id]'}, |
|
130 | assert_tag :select, :attributes => {:name => 'project[parent_id]'}, | |
131 | :child => {:tag => 'option', :attributes => {:value => '1', :selected => 'selected'}} |
|
131 | :child => {:tag => 'option', :attributes => {:value => '1', :selected => 'selected'}} |
@@ -166,7 +166,7 class RoutingTest < ActionController::IntegrationTest | |||||
166 | should_route :get, "/projects", :controller => 'projects', :action => 'index' |
|
166 | should_route :get, "/projects", :controller => 'projects', :action => 'index' | |
167 | should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom' |
|
167 | should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom' | |
168 | should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml' |
|
168 | should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml' | |
169 |
should_route :get, "/projects/new", :controller => 'projects', :action => ' |
|
169 | should_route :get, "/projects/new", :controller => 'projects', :action => 'new' | |
170 | should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test' |
|
170 | should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test' | |
171 | should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml' |
|
171 | should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml' | |
172 | should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223' |
|
172 | should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223' |
General Comments 0
You need to be logged in to leave comments.
Login now