开发者

Is it possible to change the increment value for the "% Done" field

开发者 https://www.devze.com 2023-02-14 03:29 出处:网络
Redmine has a % Done field that is used to keep track of an issue\'s progress.By default, the list box contains values in 10% increments from 0-100.Is it possible to either change the listbox to a pla

Redmine has a % Done field that is used to keep track of an issue's progress. By default, the list box contains values in 10% increments from 0-100. Is it possible to either change the listbox to a plain text field so I 开发者_如何转开发can enter in any integer from 0-100 or change the list box to display all integers from 0-100? I know I can create a custom field for this, but I want to use the built-in, if possible.


In your redmine installation look for the file

\app\views\issues\_attributes.rthml

The code for setting the 10% increment is on line 38 (Version 1.1.0)

<p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p>

Which appears to be creating an array 1 to 10 in steps of 1 which is then factored by 10 for the %. So there are several ways you could change the array list.

For example the following would give you a drop down selection with 5% steps

<p><%= f.select :done_ratio, ((0..10).step(0.5).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p>

I've just tried it on a Redmine installation and using the step of 0.5 makes the percentage complete a real number rather than an integer. So to keep it an integer this will work

<p><%= f.select :done_ratio, ((0..100).step(5).to_a.collect {|r| ["#{r} %", r] }) %></p>

Going for every 1% may make the drop down list a little on the long side.

This code is also apparent in

\app\views\issues\_form_update.rthml

But I'm not sure where that is used.

0

精彩评论

暂无评论...
验证码 换一张
取 消