2011-10-29 16:19:11 +04:00
|
|
|
#-- encoding: UTF-8
|
2011-05-30 00:11:52 +04:00
|
|
|
#-- copyright
|
|
|
|
# ChiliProject is a project management system.
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2013-01-07 02:20:49 +04:00
|
|
|
# Copyright (C) 2010-2013 the ChiliProject Team
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2011-05-30 00:11:52 +04:00
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2011-05-30 00:11:52 +04:00
|
|
|
# See doc/COPYRIGHT.rdoc for more details.
|
|
|
|
#++
|
|
|
|
|
2010-04-28 19:54:46 +04:00
|
|
|
class GanttsController < ApplicationController
|
2010-11-08 01:38:10 +03: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
|
|
|
|
|
|
|
|
include QueriesHelper
|
2010-04-29 19:19:19 +04:00
|
|
|
include SortHelper
|
2010-04-28 19:54:46 +04:00
|
|
|
include Redmine::Export::PDF
|
2011-05-30 22:52:25 +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?
|
2011-05-30 22:52:25 +04:00
|
|
|
|
2010-04-28 19:54:46 +04:00
|
|
|
basename = (@project ? "#{@project.identifier}-" : '') + 'gantt'
|
2011-05-30 22:52:25 +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
|