]> source.dussan.org Git - redmine.git/commitdiff
shorten long line of GanttsController
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Sat, 24 Oct 2020 14:39:39 +0000 (14:39 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Sat, 24 Oct 2020 14:39:39 +0000 (14:39 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@20180 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/gantts_controller.rb

index 9235d3da200dfd776241f096a4bd7ac491a3cf04..6d2c26128f96f1fd8697bcd8e562aef87fe78896 100644 (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