##// 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 35 @trackers = @projects.map(&:trackers).inject{|memo,t| memo & t}
36 36 end
37 37
38 @priorities = IssuePriority.all.reverse
38 @priorities = IssuePriority.active.reverse
39 39 @statuses = IssueStatus.find(:all, :order => 'position')
40 40 @back = back_url
41 41
@@ -115,7 +115,7 class IssuesController < ApplicationController
115 115 @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
116 116 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
117 117 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
118 @priorities = IssuePriority.all
118 @priorities = IssuePriority.active
119 119 @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
120 120 respond_to do |format|
121 121 format.html { render :template => 'issues/show.rhtml' }
@@ -279,7 +279,7 private
279 279 # TODO: Refactor, not everything in here is needed by #edit
280 280 def update_issue_from_params
281 281 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
282 @priorities = IssuePriority.all
282 @priorities = IssuePriority.active
283 283 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
284 284 @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
285 285 @time_entry.attributes = params[:time_entry]
@@ -315,7 +315,7 private
315 315 @issue.watcher_user_ids = params[:issue]['watcher_user_ids']
316 316 end
317 317 end
318 @priorities = IssuePriority.all
318 @priorities = IssuePriority.active
319 319 @allowed_statuses = @issue.new_statuses_allowed_to(User.current, true)
320 320 end
321 321
@@ -32,7 +32,7
32 32
33 33 <p>
34 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 36 </p>
37 37
38 38 <p>
@@ -21,7 +21,7
21 21 <% end %>
22 22 <p>
23 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 25 </p>
26 26 <p>
27 27 <label><%= l(:field_assigned_to) %></label>
@@ -81,3 +81,9 enumerations_014:
81 81 type: TimeEntryActivity
82 82 position: 4
83 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 17 assert_tag :tag => 'a', :content => 'Immediate',
18 18 :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&amp;issue%5Bpriority_id%5D=8',
19 19 :class => '' }
20 assert_no_tag :tag => 'a', :content => 'Inactive Priority'
20 21 # Versions
21 22 assert_tag :tag => 'a', :content => '2.0',
22 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 7 User.current = nil
8 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 29 def test_create_one_issue_to_another_project
11 30 @request.session[:user_id] = 2
12 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 318 :content => /Notes/ } }
319 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 331 def test_show_should_deny_anonymous_access_without_permission
322 332 Role.anonymous.remove_permission!(:view_issues)
323 333 get :show, :id => 1
@@ -419,6 +429,11 class IssuesControllerTest < ActionController::TestCase
419 429
420 430 assert_tag :tag => 'input', :attributes => { :name => 'issue[custom_field_values][2]',
421 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 437 end
423 438
424 439 def test_get_new_without_tracker_id
@@ -833,6 +848,11 class IssuesControllerTest < ActionController::TestCase
833 848 assert_template 'edit'
834 849 assert_not_nil assigns(:issue)
835 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 856 end
837 857
838 858 def test_get_edit_with_params
@@ -1185,6 +1205,11 class IssuesControllerTest < ActionController::TestCase
1185 1205 # System wide custom field
1186 1206 assert CustomField.find(1).is_for_all?
1187 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 1213 end
1189 1214
1190 1215 def test_get_bulk_edit_on_different_projects
General Comments 0
You need to be logged in to leave comments. Login now