shorten long line of GanttsController

git-svn-id: http://svn.redmine.org/redmine/trunk@20180 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA
2020-10-24 14:39:39 +00:00
parent 8a7bfc57a4
commit 58a04e2aff

View File

@@ -40,9 +40,19 @@ class GanttsController < ApplicationController
basename = (@project ? "#{@project.identifier}-" : '') + 'gantt'
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.pdf { send_data(@gantt.to_pdf, :type => 'application/pdf', :filename => "#{basename}.pdf") }
format.html {render :action => "show", :layout => !request.xhr?}
if @gantt.respond_to?('to_image')
format.png do
send_data(@gantt.to_image,
:disposition => 'inline', :type => 'image/png',
:filename => "#{basename}.png")
end
end
format.pdf do
send_data(@gantt.to_pdf,
:type => 'application/pdf',
:filename => "#{basename}.pdf")
end
end
end
end