Commit 701d2eae authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Display project names in cross-project gantt PNG (#5904).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3885 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent bdad35a7
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment