diff options
-rw-r--r-- | app/views/issue_statuses/_form.html.erb | 2 | ||||
-rw-r--r-- | app/views/issues/_attributes.html.erb | 2 | ||||
-rw-r--r-- | app/views/issues/bulk_edit.html.erb | 2 | ||||
-rw-r--r-- | app/views/settings/_issues.html.erb | 2 | ||||
-rw-r--r-- | app/views/settings/_repositories.html.erb | 2 | ||||
-rw-r--r-- | config/locales/en.yml | 1 | ||||
-rw-r--r-- | config/settings.yml | 3 | ||||
-rw-r--r-- | test/functional/issues_controller_test.rb | 15 |
8 files changed, 25 insertions, 4 deletions
diff --git a/app/views/issue_statuses/_form.html.erb b/app/views/issue_statuses/_form.html.erb index 8f06451c6..c2487b002 100644 --- a/app/views/issue_statuses/_form.html.erb +++ b/app/views/issue_statuses/_form.html.erb @@ -4,7 +4,7 @@ <p><%= f.text_field :name, :required => true %></p> <p><%= f.text_area :description, :rows => 4 %></p> <% if Issue.use_status_for_done_ratio? %> - <p><%= f.select :default_done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }), :include_blank => true, :label => :field_done_ratio %></p> + <p><%= f.select :default_done_ratio, ((0..100).step(Setting.issue_done_ratio_interval.to_i).to_a.collect {|r| ["#{r} %", r]}), :include_blank => true, :label => :field_done_ratio %></p> <% end %> <p><%= f.check_box :is_closed %></p> diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb index 40b89547a..517b67f95 100644 --- a/app/views/issues/_attributes.html.erb +++ b/app/views/issues/_attributes.html.erb @@ -88,7 +88,7 @@ <% end %> <% if @issue.safe_attribute?('done_ratio') && Issue.use_field_for_done_ratio? %> -<p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }), :required => @issue.required_attribute?('done_ratio') %></p> +<p><%= f.select :done_ratio, ((0..100).step(Setting.issue_done_ratio_interval.to_i).to_a.collect {|r| ["#{r} %", r]}), :required => @issue.required_attribute?('done_ratio') %></p> <% end %> </div> </div> diff --git a/app/views/issues/bulk_edit.html.erb b/app/views/issues/bulk_edit.html.erb index 4fe457b32..a379305be 100644 --- a/app/views/issues/bulk_edit.html.erb +++ b/app/views/issues/bulk_edit.html.erb @@ -178,7 +178,7 @@ <% if @safe_attributes.include?('done_ratio') && Issue.use_field_for_done_ratio? %> <p> <label for='issue_done_ratio'><%= l(:field_done_ratio) %></label> - <%= select_tag 'issue[done_ratio]', options_for_select([[l(:label_no_change_option), '']] + (0..10).to_a.collect {|r| ["#{r*10} %", r*10] }, @issue_params[:done_ratio]) %> + <%= select_tag 'issue[done_ratio]', options_for_select([[l(:label_no_change_option), '']] + (0..100).step(Setting.issue_done_ratio_interval.to_i).to_a.collect {|r| ["#{r} %", r]}, @issue_params[:done_ratio]) %> </p> <% end %> </div> diff --git a/app/views/settings/_issues.html.erb b/app/views/settings/_issues.html.erb index 68f9a1d7b..7532d5d0e 100644 --- a/app/views/settings/_issues.html.erb +++ b/app/views/settings/_issues.html.erb @@ -17,6 +17,8 @@ <p><%= setting_select :issue_done_ratio, Issue::DONE_RATIO_OPTIONS.collect {|i| [l("setting_issue_done_ratio_#{i}"), i]} %></p> +<p><%= setting_select :issue_done_ratio_interval, [5, 10].collect {|i| ["#{i} %", i]} %></p> + <p><%= setting_multiselect :non_working_week_days, (1..7).map {|d| [day_name(d), d.to_s]}, :inline => true %></p> <p><%= setting_text_field :issues_export_limit, :size => 6 %></p> diff --git a/app/views/settings/_repositories.html.erb b/app/views/settings/_repositories.html.erb index adac52fc7..f89a27944 100644 --- a/app/views/settings/_repositories.html.erb +++ b/app/views/settings/_repositories.html.erb @@ -114,7 +114,7 @@ <%= select_tag("settings[commit_update_keywords][done_ratio][]", options_for_select( [["", ""]] + - (0..10).to_a.collect {|r| ["#{r*10} %", "#{r*10}"] }, + (0..100).step(Setting.issue_done_ratio_interval.to_i).to_a.collect {|r| ["#{r} %", r]}, rule['done_ratio']), :id => nil ) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index c842e4d7b..2361dac08 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -477,6 +477,7 @@ en: setting_default_projects_modules: Default enabled modules for new projects setting_issue_done_ratio: Calculate the issue done ratio with setting_issue_done_ratio_issue_field: Use the issue field + setting_issue_done_ratio_interval: Done ratio options interval setting_issue_done_ratio_issue_status: Use the issue status setting_start_of_week: Start calendars on setting_rest_api_enabled: Enable REST web service diff --git a/config/settings.yml b/config/settings.yml index bd3795756..346288a4a 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -256,6 +256,9 @@ default_project_query: default: '' issue_done_ratio: default: 'issue_field' +issue_done_ratio_interval: + format: int + default: 10 default_projects_public: default: 1 default_projects_modules: diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 53cfd8146..12ec7a6d5 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -8736,4 +8736,19 @@ class IssuesControllerTest < Redmine::ControllerTest end end end + + def test_get_new_with_issue_field_five_percent_increments + with_settings :issue_done_ratio => 'issue_field', :issue_done_ratio_interval => 5 do + @request.session[:user_id] = 1 + get :new + assert_response :success + + assert_select 'select#issue_done_ratio' do + assert_select 'option', count: 21 + assert_select 'option:nth-of-type(1)', text: '0 %' + assert_select 'option:nth-of-type(2)', text: '5 %' + assert_select 'option:nth-of-type(21)', text: '100 %' + end + end + end end |