##// END OF EJS Templates
Do not show inactive issue priorities where not necessary (#8573)....
Jean-Baptiste Barth -
r5950:d5cc7424a815
parent child
Show More
@@ -35,7 +35,7 class ContextMenusController < ApplicationController
35 @trackers = @projects.map(&:trackers).inject{|memo,t| memo & t}
35 @trackers = @projects.map(&:trackers).inject{|memo,t| memo & t}
36 end
36 end
37
37
38 @priorities = IssuePriority.all.reverse
38 @priorities = IssuePriority.active.reverse
39 @statuses = IssueStatus.find(:all, :order => 'position')
39 @statuses = IssueStatus.find(:all, :order => 'position')
40 @back = back_url
40 @back = back_url
41
41
@@ -115,7 +115,7 class IssuesController < ApplicationController
115 @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
115 @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
116 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
116 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
117 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
117 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
118 @priorities = IssuePriority.all
118 @priorities = IssuePriority.active
119 @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
119 @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
120 respond_to do |format|
120 respond_to do |format|
121 format.html { render :template => 'issues/show.rhtml' }
121 format.html { render :template => 'issues/show.rhtml' }
@@ -279,7 +279,7 private
279 # TODO: Refactor, not everything in here is needed by #edit
279 # TODO: Refactor, not everything in here is needed by #edit
280 def update_issue_from_params
280 def update_issue_from_params
281 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
281 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
282 @priorities = IssuePriority.all
282 @priorities = IssuePriority.active
283 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
283 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
284 @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
284 @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
285 @time_entry.attributes = params[:time_entry]
285 @time_entry.attributes = params[:time_entry]
@@ -315,7 +315,7 private
315 @issue.watcher_user_ids = params[:issue]['watcher_user_ids']
315 @issue.watcher_user_ids = params[:issue]['watcher_user_ids']
316 end
316 end
317 end
317 end
318 @priorities = IssuePriority.all
318 @priorities = IssuePriority.active
319 @allowed_statuses = @issue.new_statuses_allowed_to(User.current, true)
319 @allowed_statuses = @issue.new_statuses_allowed_to(User.current, true)
320 end
320 end
321
321
@@ -32,7 +32,7
32
32
33 <p>
33 <p>
34 <label><%= l(:field_priority) %></label>
34 <label><%= l(:field_priority) %></label>
35 <%= select_tag('priority_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(IssuePriority.all, :id, :name)) %>
35 <%= select_tag('priority_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(IssuePriority.active, :id, :name)) %>
36 </p>
36 </p>
37
37
38 <p>
38 <p>
@@ -21,7 +21,7
21 <% end %>
21 <% end %>
22 <p>
22 <p>
23 <label><%= l(:field_priority) %></label>
23 <label><%= l(:field_priority) %></label>
24 <%= select_tag('issue[priority_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(IssuePriority.all, :id, :name)) %>
24 <%= select_tag('issue[priority_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(IssuePriority.active, :id, :name)) %>
25 </p>
25 </p>
26 <p>
26 <p>
27 <label><%= l(:field_assigned_to) %></label>
27 <label><%= l(:field_assigned_to) %></label>
@@ -81,3 +81,9 enumerations_014:
81 type: TimeEntryActivity
81 type: TimeEntryActivity
82 position: 4
82 position: 4
83 active: false
83 active: false
84 enumerations_015:
85 name: Inactive Priority
86 id: 15
87 type: IssuePriority
88 position: 6
89 active: false
@@ -17,6 +17,7 class ContextMenusControllerTest < ActionController::TestCase
17 assert_tag :tag => 'a', :content => 'Immediate',
17 assert_tag :tag => 'a', :content => 'Immediate',
18 :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&amp;issue%5Bpriority_id%5D=8',
18 :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&amp;issue%5Bpriority_id%5D=8',
19 :class => '' }
19 :class => '' }
20 assert_no_tag :tag => 'a', :content => 'Inactive Priority'
20 # Versions
21 # Versions
21 assert_tag :tag => 'a', :content => '2.0',
22 assert_tag :tag => 'a', :content => '2.0',
22 :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&amp;issue%5Bfixed_version_id%5D=3',
23 :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&amp;issue%5Bfixed_version_id%5D=3',
@@ -7,6 +7,25 class IssueMovesControllerTest < ActionController::TestCase
7 User.current = nil
7 User.current = nil
8 end
8 end
9
9
10 def test_get_issue_moves_new
11 @request.session[:user_id] = 2
12 get :new, :id => 1
13
14 assert_tag :tag => 'option', :content => 'eCookbook',
15 :attributes => { :value => '1', :selected => 'selected' }
16 %w(new_tracker_id status_id priority_id assigned_to_id).each do |field|
17 assert_tag :tag => 'option', :content => '(No change)', :attributes => { :value => '' },
18 :parent => {:tag => 'select', :attributes => {:id => field}}
19 assert_no_tag :tag => 'option', :attributes => {:selected => 'selected'},
20 :parent => {:tag => 'select', :attributes => {:id => field}}
21 end
22
23 # Be sure we don't include inactive enumerations
24 assert ! IssuePriority.find(15).active?
25 assert_no_tag :option, :attributes => {:value => '15'},
26 :parent => {:tag => 'select', :attributes => {:id => 'priority_id'} }
27 end
28
10 def test_create_one_issue_to_another_project
29 def test_create_one_issue_to_another_project
11 @request.session[:user_id] = 2
30 @request.session[:user_id] = 2
12 post :create, :id => 1, :new_project_id => 2, :tracker_id => '', :assigned_to_id => '', :status_id => '', :start_date => '', :due_date => ''
31 post :create, :id => 1, :new_project_id => 2, :tracker_id => '', :assigned_to_id => '', :status_id => '', :start_date => '', :due_date => ''
@@ -318,6 +318,16 class IssuesControllerTest < ActionController::TestCase
318 :content => /Notes/ } }
318 :content => /Notes/ } }
319 end
319 end
320
320
321 def test_update_form_should_not_display_inactive_enumerations
322 @request.session[:user_id] = 2
323 get :show, :id => 1
324 assert_response :success
325
326 assert ! IssuePriority.find(15).active?
327 assert_no_tag :option, :attributes => {:value => '15'},
328 :parent => {:tag => 'select', :attributes => {:id => 'issue_priority_id'} }
329 end
330
321 def test_show_should_deny_anonymous_access_without_permission
331 def test_show_should_deny_anonymous_access_without_permission
322 Role.anonymous.remove_permission!(:view_issues)
332 Role.anonymous.remove_permission!(:view_issues)
323 get :show, :id => 1
333 get :show, :id => 1
@@ -419,6 +429,11 class IssuesControllerTest < ActionController::TestCase
419
429
420 assert_tag :tag => 'input', :attributes => { :name => 'issue[custom_field_values][2]',
430 assert_tag :tag => 'input', :attributes => { :name => 'issue[custom_field_values][2]',
421 :value => 'Default string' }
431 :value => 'Default string' }
432
433 # Be sure we don't display inactive IssuePriorities
434 assert ! IssuePriority.find(15).active?
435 assert_no_tag :option, :attributes => {:value => '15'},
436 :parent => {:tag => 'select', :attributes => {:id => 'issue_priority_id'} }
422 end
437 end
423
438
424 def test_get_new_without_tracker_id
439 def test_get_new_without_tracker_id
@@ -833,6 +848,11 class IssuesControllerTest < ActionController::TestCase
833 assert_template 'edit'
848 assert_template 'edit'
834 assert_not_nil assigns(:issue)
849 assert_not_nil assigns(:issue)
835 assert_equal Issue.find(1), assigns(:issue)
850 assert_equal Issue.find(1), assigns(:issue)
851
852 # Be sure we don't display inactive IssuePriorities
853 assert ! IssuePriority.find(15).active?
854 assert_no_tag :option, :attributes => {:value => '15'},
855 :parent => {:tag => 'select', :attributes => {:id => 'issue_priority_id'} }
836 end
856 end
837
857
838 def test_get_edit_with_params
858 def test_get_edit_with_params
@@ -1185,6 +1205,11 class IssuesControllerTest < ActionController::TestCase
1185 # System wide custom field
1205 # System wide custom field
1186 assert CustomField.find(1).is_for_all?
1206 assert CustomField.find(1).is_for_all?
1187 assert_tag :select, :attributes => {:name => 'issue[custom_field_values][1]'}
1207 assert_tag :select, :attributes => {:name => 'issue[custom_field_values][1]'}
1208
1209 # Be sure we don't display inactive IssuePriorities
1210 assert ! IssuePriority.find(15).active?
1211 assert_no_tag :option, :attributes => {:value => '15'},
1212 :parent => {:tag => 'select', :attributes => {:id => 'issue_priority_id'} }
1188 end
1213 end
1189
1214
1190 def test_get_bulk_edit_on_different_projects
1215 def test_get_bulk_edit_on_different_projects
General Comments 0
You need to be logged in to leave comments. Login now