]> source.dussan.org Git - redmine.git/commitdiff
Add project names to the Versions in the Gantt export. #5904
authorEric Davis <edavis@littlestreamsoftware.com>
Fri, 10 Sep 2010 03:09:11 +0000 (03:09 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Fri, 10 Sep 2010 03:09:11 +0000 (03:09 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4073 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/version.rb
lib/redmine/helpers/gantt.rb

index c3969fe87e817c97d80f12fb6e8eae96e582568e..95e6ad5f6a672d7655889002fca01a3e595279b2 100644 (file)
@@ -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"
index 33a4e1c2c1e4509d734500cca6bac2751969e91f..7c694022af4df37f6d137a78c8fefebb5299b692 100644 (file)
@@ -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])