<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>
<% 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>
<% 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>
<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>
<%= 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
) %>
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
default: ''
issue_done_ratio:
default: 'issue_field'
+issue_done_ratio_interval:
+ format: int
+ default: 10
default_projects_public:
default: 1
default_projects_modules:
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