From 9ad79612fed43e70f318aed2f90d8b29ad667a77 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 17 Nov 2007 15:34:10 +0000 Subject: Roadmap: more accurate completion percentage calculation (done ratio of open issues is now taken into account). Issues and issues list: 'done ratio' field now displayed as a progress bar. git-svn-id: http://redmine.rubyforge.org/svn/trunk@908 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 11 +++++++++++ app/helpers/queries_helper.rb | 11 ++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'app/helpers') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e9ea74e2d..215945423 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -313,6 +313,17 @@ module ApplicationHelper link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)") end + def progress_bar(pct, options={}) + 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') : '') + ), :class => 'progress', :style => "width: #{width};") + + content_tag('p', legend, :class => 'pourcent') + end + def context_menu_link(name, url, options={}) options[:class] ||= '' if options.delete(:selected) diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index 6e5511f08..f92787278 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -35,11 +35,16 @@ module QueriesHelper format_date(value) elsif value.is_a?(Time) format_time(value) - elsif column.name == :subject + else + case column.name + when :subject ((@project.nil? || @project != issue.project) ? "#{issue.project.name} - " : '') + link_to(h(value), :controller => 'issues', :action => 'show', :id => issue) - else - h(value) + when :done_ratio + progress_bar(value, :width => '80px') + else + h(value) + end end end end -- cgit v1.2.3