2010-04-28 19:54:46 +04:00
|
|
|
class GanttsController < ApplicationController
|
2010-08-19 08:33:57 +04:00
|
|
|
menu_item :gantt
|
2010-04-28 19:54:46 +04:00
|
|
|
before_filter :find_optional_project
|
|
|
|
|
|
|
|
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
|
|
|
|
|
2010-09-10 07:09:02 +04:00
|
|
|
helper :gantt
|
2010-04-28 19:54:46 +04:00
|
|
|
helper :issues
|
|
|
|
helper :projects
|
|
|
|
helper :queries
|
|
|
|
include QueriesHelper
|
2010-04-29 19:19:19 +04:00
|
|
|
helper :sort
|
|
|
|
include SortHelper
|
2010-04-28 19:54:46 +04:00
|
|
|
include Redmine::Export::PDF
|
2010-10-26 20:20:57 +04:00
|
|
|
|
2010-04-28 19:54:46 +04:00
|
|
|
def show
|
|
|
|
@gantt = Redmine::Helpers::Gantt.new(params)
|
2010-09-10 07:09:02 +04:00
|
|
|
@gantt.project = @project
|
2010-04-28 19:54:46 +04:00
|
|
|
retrieve_query
|
|
|
|
@query.group_by = nil
|
2010-09-10 07:09:02 +04:00
|
|
|
@gantt.query = @query if @query.valid?
|
2010-10-26 20:20:57 +04:00
|
|
|
|
2010-04-28 19:54:46 +04:00
|
|
|
basename = (@project ? "#{@project.identifier}-" : '') + 'gantt'
|
2010-10-26 20:20:57 +04:00
|
|
|
|
2010-04-28 19:54:46 +04:00
|
|
|
respond_to do |format|
|
|
|
|
format.html { render :action => "show", :layout => !request.xhr? }
|
2010-09-10 07:09:02 +04:00
|
|
|
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") }
|
2010-04-28 19:54:46 +04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-08-26 20:36:59 +04:00
|
|
|
def update
|
|
|
|
show
|
|
|
|
end
|
|
|
|
|
2010-04-28 19:54:46 +04:00
|
|
|
end
|