summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-17 15:34:10 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-17 15:34:10 +0000
commit9ad79612fed43e70f318aed2f90d8b29ad667a77 (patch)
tree8030568ddb4230e06f329f8aec733edf7afe8ccd /app/helpers
parent1469a4c8df574d066c49b55f9fd9096638740272 (diff)
downloadredmine-9ad79612fed43e70f318aed2f90d8b29ad667a77.tar.gz
redmine-9ad79612fed43e70f318aed2f90d8b29ad667a77.zip
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
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb11
-rw-r--r--app/helpers/queries_helper.rb11
2 files changed, 19 insertions, 3 deletions
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