Tracのマイルストーン表示を改善する

Tracマイルストーンは少々味気なくて、デフォルト状態ではクローズしたチケットとオープンなチケットの2種類しか表示してくれない。でも、ほんの少しだけ手を加えると、各ステータスのチケット数も表示されて良い感じになる(プラグインは不要!)。動作環境は下記の通り。

変更箇所は下記の通り。

  • ロードマップのCSSファイルへ追記する。手元の環境では下記のファイルが該当。

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/trac/htdocs/css/roadmap.css

table.progress td.red { background: #ffcccc }
table.progress td.blue { background: #99ccff }
table.progress td.orange { background: #ffcc99 }
  • プロジェクトの設定ファイルに追記する。
    {Project}/conf/trac.ini
[milestone-groups]
closed = closed
closed.label = Closed
closed.order = 1
closed.overall_completion = true
closed.query_args = group=resolution
accepted = accepted
accepted.css_class = orange
accepted.label = Working
accepted.order = 2
assigned = reopened
assigned.css_class = red
assigned.label = Reopened
assigned.order = 3
new = new
new.css_class = open
new.label = Open

ヘルプにも記載されている情報なのだけど、デフォルトでは無効なのであまり知られていないのかも知れない。

(since 0.11)

As the workflow for tickets is now configurable, there can be many ticket states, and simply displaying closed tickets vs. all the others is maybe not appropriate in all cases. This section enables one to easily create groups of states that will be shown in different colors in the milestone progress bar.

TracIni – The Trac Project