diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-12-05 19:21:25 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-12-05 19:21:25 +0000 |
commit | 355289fa677f6a9a26e252e640861497a34cada6 (patch) | |
tree | f243244e713bec77cfe16a5b27f97636769dad53 /app | |
parent | b536f4c65794d8c2c5e5ae0c0a63166106bc3303 (diff) | |
download | redmine-355289fa677f6a9a26e252e640861497a34cada6.tar.gz redmine-355289fa677f6a9a26e252e640861497a34cada6.zip |
Roadmap progress bars now differentiate the progress due to closed issues from the open issues progress (2 different colors).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@954 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/application_helper.rb | 10 | ||||
-rw-r--r-- | app/models/version.rb | 8 | ||||
-rw-r--r-- | app/views/projects/roadmap.rhtml | 2 |
3 files changed, 16 insertions, 4 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f4746c627..37c8b1c9b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -319,13 +319,17 @@ module ApplicationHelper link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)") end - def progress_bar(pct, options={}) + def progress_bar(pcts, options={}) + pcts = [pcts, pcts] unless pcts.is_a?(Array) + pcts[1] = pcts[1] - pcts[0] + pcts << (100 - pcts[1] - pcts[0]) width = options[:width] || '100px;' legend = options[:legend] || '' content_tag('table', content_tag('tr', - (pct > 0 ? content_tag('td', '', :width => "#{pct.floor}%;", :class => 'closed') : '') + - (pct < 100 ? content_tag('td', '', :width => "#{100-pct.floor}%;", :class => 'open') : '') + (pcts[0] > 0 ? content_tag('td', '', :width => "#{pcts[0].floor}%;", :class => 'closed') : '') + + (pcts[1] > 0 ? content_tag('td', '', :width => "#{pcts[1].floor}%;", :class => 'done') : '') + + (pcts[2] > 0 ? content_tag('td', '', :width => "#{pcts[2].floor}%;", :class => 'todo') : '') ), :class => 'progress', :style => "width: #{width};") + content_tag('p', legend, :class => 'pourcent') end diff --git a/app/models/version.rb b/app/models/version.rb index 0547dbabc..266346c7b 100644 --- a/app/models/version.rb +++ b/app/models/version.rb @@ -49,6 +49,14 @@ class Version < ActiveRecord::Base end end + def closed_pourcent + if fixed_issues.count == 0 + 0 + else + closed_issues_count * 100.0 / fixed_issues.count + end + end + # Returns true if the version is overdue: due date reached and some open issues def overdue? effective_date && (effective_date < Date.today) && (open_issues_count > 0) diff --git a/app/views/projects/roadmap.rhtml b/app/views/projects/roadmap.rhtml index c2f3cbf34..7c3544a53 100644 --- a/app/views/projects/roadmap.rhtml +++ b/app/views/projects/roadmap.rhtml @@ -16,7 +16,7 @@ <p><%=h version.description %></p> <% if version.fixed_issues.count > 0 %> - <%= progress_bar(version.completed_pourcent, :width => '40em', :legend => ('%0.0f%' % version.completed_pourcent)) %> + <%= progress_bar([version.closed_pourcent, version.completed_pourcent], :width => '40em', :legend => ('%0.0f%' % version.completed_pourcent)) %> <p class="progress-info"> <%= link_to(version.closed_issues_count, :controller => 'issues', :action => 'index', :project_id => @project, :status_id => 'c', :fixed_version_id => version, :set_filter => 1) %> <%= lwr(:label_closed_issues, version.closed_issues_count) %> |