@@ -37,7 +37,7 class GanttsController < ApplicationController | |||||
37 |
|
37 | |||
38 | respond_to do |format| |
|
38 | respond_to do |format| | |
39 | format.html { render :action => "show", :layout => !request.xhr? } |
|
39 | format.html { render :action => "show", :layout => !request.xhr? } | |
40 | format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image') |
|
40 | format.png { send_data(@gantt.to_image(@project), :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image') | |
41 | format.pdf { send_data(gantt_to_pdf(@gantt, @project), :type => 'application/pdf', :filename => "#{basename}.pdf") } |
|
41 | format.pdf { send_data(gantt_to_pdf(@gantt, @project), :type => 'application/pdf', :filename => "#{basename}.pdf") } | |
42 | end |
|
42 | end | |
43 | end |
|
43 | end |
@@ -91,12 +91,12 module Redmine | |||||
91 |
|
91 | |||
92 | # Generates a gantt image |
|
92 | # Generates a gantt image | |
93 | # Only defined if RMagick is avalaible |
|
93 | # Only defined if RMagick is avalaible | |
94 | def to_image(format='PNG') |
|
94 | def to_image(project, format='PNG') | |
95 | date_to = (@date_from >> @months)-1 |
|
95 | date_to = (@date_from >> @months)-1 | |
96 | show_weeks = @zoom > 1 |
|
96 | show_weeks = @zoom > 1 | |
97 | show_days = @zoom > 2 |
|
97 | show_days = @zoom > 2 | |
98 |
|
98 | |||
99 |
subject_width = |
|
99 | subject_width = 400 | |
100 | header_heigth = 18 |
|
100 | header_heigth = 18 | |
101 | # width of one day in pixels |
|
101 | # width of one day in pixels | |
102 | zoom = @zoom*2 |
|
102 | zoom = @zoom*2 | |
@@ -115,7 +115,14 module Redmine | |||||
115 | gc.stroke('transparent') |
|
115 | gc.stroke('transparent') | |
116 | gc.stroke_width(1) |
|
116 | gc.stroke_width(1) | |
117 | events.each do |i| |
|
117 | events.each do |i| | |
118 | gc.text(4, top + 2, (i.is_a?(Issue) ? i.subject : i.name)) |
|
118 | text = "" | |
|
119 | if i.is_a? Issue | |||
|
120 | text = "#{i.tracker} #{i.id}: #{i.subject}" | |||
|
121 | else | |||
|
122 | text = i.name | |||
|
123 | end | |||
|
124 | text = "#{i.project} - #{text}" unless project && project == i.project | |||
|
125 | gc.text(4, top + 2, text) | |||
119 | top = top + 20 |
|
126 | top = top + 20 | |
120 | end |
|
127 | end | |
121 |
|
128 |
General Comments 0
You need to be logged in to leave comments.
Login now