##// END OF EJS Templates
Restores the "New issue" tab in the project menu and makes it optional (#6204)....
Jean-Philippe Lang -
r15025:4019ba76ab30
parent child
Show More
@@ -350,6 +350,16 class IssuesController < ApplicationController
350 end
350 end
351 end
351 end
352
352
353 # Overrides Redmine::MenuManager::MenuController::ClassMethods for
354 # when the "New issue" tab is enabled
355 def current_menu_item
356 if Setting.new_project_issue_tab_enabled? && [:new, :create].include?(action_name.to_sym)
357 :new_issue
358 else
359 super
360 end
361 end
362
353 private
363 private
354
364
355 def retrieve_previous_and_next_issue_ids
365 def retrieve_previous_and_next_issue_ids
@@ -24,6 +24,8
24 <p><%= setting_check_box :thumbnails_enabled %></p>
24 <p><%= setting_check_box :thumbnails_enabled %></p>
25
25
26 <p><%= setting_text_field :thumbnails_size, :size => 6 %></p>
26 <p><%= setting_text_field :thumbnails_size, :size => 6 %></p>
27
28 <p><%= setting_check_box :new_project_issue_tab_enabled %></p>
27 </div>
29 </div>
28
30
29 <%= submit_tag l(:button_save) %>
31 <%= submit_tag l(:button_save) %>
@@ -443,6 +443,7 en:
443 setting_search_results_per_page: Search results per page
443 setting_search_results_per_page: Search results per page
444 setting_attachment_extensions_allowed: Allowed extensions
444 setting_attachment_extensions_allowed: Allowed extensions
445 setting_attachment_extensions_denied: Disallowed extensions
445 setting_attachment_extensions_denied: Disallowed extensions
446 setting_new_project_issue_tab_enabled: Display the "New issue" tab
446
447
447 permission_add_project: Create project
448 permission_add_project: Create project
448 permission_add_subprojects: Create subprojects
449 permission_add_subprojects: Create subprojects
@@ -455,6 +455,7 fr:
455 setting_attachment_extensions_denied: Extensions non autorisΓ©es
455 setting_attachment_extensions_denied: Extensions non autorisΓ©es
456 setting_sys_api_key: ClΓ© de protection de l'API
456 setting_sys_api_key: ClΓ© de protection de l'API
457 setting_lost_password: Autoriser la rΓ©initialisation par email de mot de passe perdu
457 setting_lost_password: Autoriser la rΓ©initialisation par email de mot de passe perdu
458 setting_new_project_issue_tab_enabled: Afficher l'onglet "Nouvelle demande"
458
459
459 permission_add_project: CrΓ©er un projet
460 permission_add_project: CrΓ©er un projet
460 permission_add_subprojects: CrΓ©er des sous-projets
461 permission_add_subprojects: CrΓ©er des sous-projets
@@ -275,3 +275,5 non_working_week_days:
275 default:
275 default:
276 - '6'
276 - '6'
277 - '7'
277 - '7'
278 new_project_issue_tab_enabled:
279 default: 0
@@ -231,6 +231,10 Redmine::MenuManager.map :project_menu do |menu|
231 menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id,
231 menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id,
232 :if => Proc.new { |p| p.shared_versions.any? }
232 :if => Proc.new { |p| p.shared_versions.any? }
233 menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural
233 menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural
234 menu.push :new_issue, { :controller => 'issues', :action => 'new', :copy_from => nil }, :param => :project_id, :caption => :label_issue_new,
235 :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) },
236 :if => Proc.new { |p| Setting.new_project_issue_tab_enabled? && p.trackers.any? },
237 :permission => :add_issues
234 menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt
238 menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt
235 menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar
239 menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar
236 menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural
240 menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural
@@ -1060,7 +1060,7 class IssuesControllerTest < ActionController::TestCase
1060 def test_index_should_include_new_issue_link
1060 def test_index_should_include_new_issue_link
1061 @request.session[:user_id] = 2
1061 @request.session[:user_id] = 2
1062 get :index, :project_id => 1
1062 get :index, :project_id => 1
1063 assert_select 'a.new-issue[href="/projects/ecookbook/issues/new"]', :text => 'New issue'
1063 assert_select '#content a.new-issue[href="/projects/ecookbook/issues/new"]', :text => 'New issue'
1064 end
1064 end
1065
1065
1066 def test_index_should_not_include_new_issue_link_for_project_without_trackers
1066 def test_index_should_not_include_new_issue_link_for_project_without_trackers
@@ -1068,7 +1068,7 class IssuesControllerTest < ActionController::TestCase
1068
1068
1069 @request.session[:user_id] = 2
1069 @request.session[:user_id] = 2
1070 get :index, :project_id => 1
1070 get :index, :project_id => 1
1071 assert_select 'a.new-issue', 0
1071 assert_select '#content a.new-issue', 0
1072 end
1072 end
1073
1073
1074 def test_index_should_not_include_new_issue_link_for_users_with_copy_issues_permission_only
1074 def test_index_should_not_include_new_issue_link_for_users_with_copy_issues_permission_only
@@ -1078,13 +1078,59 class IssuesControllerTest < ActionController::TestCase
1078
1078
1079 @request.session[:user_id] = 2
1079 @request.session[:user_id] = 2
1080 get :index, :project_id => 1
1080 get :index, :project_id => 1
1081 assert_select 'a.new-issue', 0
1081 assert_select '#content a.new-issue', 0
1082 end
1082 end
1083
1083
1084 def test_index_without_project_should_include_new_issue_link
1084 def test_index_without_project_should_include_new_issue_link
1085 @request.session[:user_id] = 2
1085 @request.session[:user_id] = 2
1086 get :index
1086 get :index
1087 assert_select 'a.new-issue[href="/issues/new"]', :text => 'New issue'
1087 assert_select '#content a.new-issue[href="/issues/new"]', :text => 'New issue'
1088 end
1089
1090 def test_index_should_not_include_new_issue_tab_when_disabled
1091 with_settings :new_project_issue_tab_enabled => '0' do
1092 @request.session[:user_id] = 2
1093 get :index, :project_id => 1
1094 assert_select '#main-menu a.new-issue', 0
1095 end
1096 end
1097
1098 def test_index_should_include_new_issue_tab_when_enabled
1099 with_settings :new_project_issue_tab_enabled => '1' do
1100 @request.session[:user_id] = 2
1101 get :index, :project_id => 1
1102 assert_select '#main-menu a.new-issue[href="/projects/ecookbook/issues/new"]', :text => 'New issue'
1103 end
1104 end
1105
1106 def test_new_should_have_new_issue_tab_as_current_menu_item
1107 with_settings :new_project_issue_tab_enabled => '1' do
1108 @request.session[:user_id] = 2
1109 get :new, :project_id => 1
1110 assert_select '#main-menu a.new-issue.selected'
1111 end
1112 end
1113
1114 def test_index_should_not_include_new_issue_tab_for_project_without_trackers
1115 with_settings :new_project_issue_tab_enabled => '1' do
1116 Project.find(1).trackers.clear
1117
1118 @request.session[:user_id] = 2
1119 get :index, :project_id => 1
1120 assert_select '#main-menu a.new-issue', 0
1121 end
1122 end
1123
1124 def test_index_should_not_include_new_issue_tab_for_users_with_copy_issues_permission_only
1125 with_settings :new_project_issue_tab_enabled => '1' do
1126 role = Role.find(1)
1127 role.remove_permission! :add_issues
1128 role.add_permission! :copy_issues
1129
1130 @request.session[:user_id] = 2
1131 get :index, :project_id => 1
1132 assert_select '#main-menu a.new-issue', 0
1133 end
1088 end
1134 end
1089
1135
1090 def test_show_by_anonymous
1136 def test_show_by_anonymous
General Comments 0
You need to be logged in to leave comments. Login now