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