summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-09-10 03:09:02 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-09-10 03:09:02 +0000
commitbdb3937e0f4c8faceb463e23cb28676930ddbd9e (patch)
tree8d8a5d1b5b78b1b206363549f8635a2e3b29ff32 /app/controllers
parent8d52608dbad63d504ec4b48ffe5ea09cfbe95bd9 (diff)
downloadredmine-bdb3937e0f4c8faceb463e23cb28676930ddbd9e.tar.gz
redmine-bdb3937e0f4c8faceb463e23cb28676930ddbd9e.zip
Rewrite the Gantt chart. #6276
This version of the Gantt chart supports nested charts. So Projects, Versions, and Issues will be nested underneath their parents correctly. Additional features: * Move all Gantt code to Redmine::Helpers::Gantt class instead of having it in the Gantt class, controller, and view * Recursive and nest sub-projects * Recursive and nest versions * Recursive and nest issues * Draw a line showing when a Project is active and it's progress * Draw a line showing when a Version is active and it's progress * Show a version's % complete * Change the color of Projects, Versions, and Issues if they are late or behind schedule * Added Project#start_date and #due_date * Added Project#completed_percent * Use a mini-gravatar on the Gantt chart * Added tests for the Gantt rendering git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4072 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/gantts_controller.rb24
-rw-r--r--app/controllers/issues_controller.rb1
2 files changed, 6 insertions, 19 deletions
diff --git a/app/controllers/gantts_controller.rb b/app/controllers/gantts_controller.rb
index 6a6071e86..50fd8c13d 100644
--- a/app/controllers/gantts_controller.rb
+++ b/app/controllers/gantts_controller.rb
@@ -4,6 +4,7 @@ class GanttsController < ApplicationController
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
+ helper :gantt
helper :issues
helper :projects
helper :queries
@@ -14,32 +15,17 @@ class GanttsController < ApplicationController
def show
@gantt = Redmine::Helpers::Gantt.new(params)
+ @gantt.project = @project
retrieve_query
@query.group_by = nil
- if @query.valid?
- events = []
- # Issues that have start and due dates
- events += @query.issues(:include => [:tracker, :assigned_to, :priority],
- :order => "start_date, due_date",
- :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null)", @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to]
- )
- # Issues that don't have a due date but that are assigned to a version with a date
- events += @query.issues(:include => [:tracker, :assigned_to, :priority, :fixed_version],
- :order => "start_date, effective_date",
- :conditions => ["(((start_date>=? and start_date<=?) or (effective_date>=? and effective_date<=?) or (start_date<? and effective_date>?)) and start_date is not null and due_date is null and effective_date is not null)", @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to]
- )
- # Versions
- events += @query.versions(:conditions => ["effective_date BETWEEN ? AND ?", @gantt.date_from, @gantt.date_to])
-
- @gantt.events = events
- end
+ @gantt.query = @query if @query.valid?
basename = (@project ? "#{@project.identifier}-" : '') + 'gantt'
respond_to do |format|
format.html { render :action => "show", :layout => !request.xhr? }
- format.png { send_data(@gantt.to_image(@project), :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image')
- format.pdf { send_data(gantt_to_pdf(@gantt, @project), :type => 'application/pdf', :filename => "#{basename}.pdf") }
+ 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") }
end
end
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 0364e307c..9f58cb0a1 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -47,6 +47,7 @@ class IssuesController < ApplicationController
include SortHelper
include IssuesHelper
helper :timelog
+ helper :gantt
include Redmine::Export::PDF
verify :method => [:post, :delete],