]> source.dussan.org Git - redmine.git/commitdiff
Display project names in cross-project gantt PNG (#5904).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 25 Jul 2010 11:43:19 +0000 (11:43 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 25 Jul 2010 11:43:19 +0000 (11:43 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3885 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/gantts_controller.rb
lib/redmine/helpers/gantt.rb

index bc2d6350c18bc885d5c065488fd2c93a1477f885..e762c19c81d3388a0b81b14fd7295024fad0bdcc 100644 (file)
@@ -37,7 +37,7 @@ class GanttsController < ApplicationController
     
     respond_to do |format|
       format.html { render :action => "show", :layout => !request.xhr? }
-      format.png  { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image')
+      format.png  { send_data(@gantt.to_image(@project), :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image')
       format.pdf  { send_data(gantt_to_pdf(@gantt, @project), :type => 'application/pdf', :filename => "#{basename}.pdf") }
     end
   end
index 330b58ee740f1edfcb738bba29bee20f9a975cde..96ba4db7c0ac2020343d35613c1ce82cf2fb45c8 100644 (file)
@@ -91,12 +91,12 @@ module Redmine
       
       # Generates a gantt image
       # Only defined if RMagick is avalaible
-      def to_image(format='PNG')
+      def to_image(project, format='PNG')
         date_to = (@date_from >> @months)-1    
         show_weeks = @zoom > 1
         show_days = @zoom > 2
         
-        subject_width = 320
+        subject_width = 400
         header_heigth = 18
         # width of one day in pixels
         zoom = @zoom*2
@@ -115,7 +115,14 @@ module Redmine
         gc.stroke('transparent')
         gc.stroke_width(1)
         events.each do |i|
-          gc.text(4, top + 2, (i.is_a?(Issue) ? i.subject : i.name))
+          text = ""
+          if i.is_a? Issue
+            text = "#{i.tracker} #{i.id}: #{i.subject}"
+          else
+            text = i.name
+          end
+          text = "#{i.project} - #{text}" unless project && project == i.project
+          gc.text(4, top + 2, text)
           top = top + 20
         end