diff --git a/app/models/version.rb b/app/models/version.rb index c3969fe87..95e6ad5f6 100644 --- a/app/models/version.rb +++ b/app/models/version.rb @@ -135,6 +135,10 @@ class Version < ActiveRecord::Base end def to_s; name end + + def to_s_with_project + "#{project} - #{name}" + end # Versions are sorted by effective_date and "Project Name - Version name" # Those with no effective_date are at the end, sorted by "Project Name - Version name" diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index 33a4e1c2c..7c694022a 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.rb @@ -399,13 +399,13 @@ module Redmine options[:image].fill('black') options[:image].stroke('transparent') options[:image].stroke_width(1) - options[:image].text(options[:indent], options[:top] + 2, version.name) + options[:image].text(options[:indent], options[:top] + 2, version.to_s_with_project) when :pdf options[:pdf].SetY(options[:top]) options[:pdf].SetX(15) char_limit = PDF::MaxCharactorsForSubject - options[:indent] - options[:pdf].Cell(options[:subject_width]-15, 5, (" " * options[:indent]) +"#{version.name}".sub(/^(.{#{char_limit}}[^\s]*\s).*$/, '\1 (...)'), "LR") + options[:pdf].Cell(options[:subject_width]-15, 5, (" " * options[:indent]) +"#{version.to_s_with_project}".sub(/^(.{#{char_limit}}[^\s]*\s).*$/, '\1 (...)'), "LR") options[:pdf].SetY(options[:top]) options[:pdf].SetX(options[:subject_width])