Project

General

Profile

Defect #7352 » gantt.rb.patch

v2 - Etienne Massip, 2011-01-18 14:17

View differences:

lib/redmine/helpers/gantt.rb (working copy)
common_params.merge({:year => (date_from >> months).year, :month => (date_from >> months).month, :zoom => zoom, :months => months })
end
### Extracted from the HTML view/helpers
# Returns the list of projects to render
def project_list
if @project
projects = [@project]
else
projects = Project.roots.visible.has_module('issue_tracking')
if @query && @query.has_filter?('project_id')
project_filter = @query.filters['project_id']
projects.delete_if { |project| (project_filter[:operator] == '=') ^ !project_filter[:values].index(project.id.to_s).nil? }
end
end
projects
end
### Extracted from the HTML view/helpers
# Returns the number of rows that will be rendered on the Gantt chart
def number_of_rows
return @number_of_rows if @number_of_rows
rows = if @project
number_of_rows_on_project(@project)
else
Project.roots.visible.has_module('issue_tracking').inject(0) do |total, project|
total += number_of_rows_on_project(project)
end
rows = project_list().each do |total, project|
total += number_of_rows_on_project(project)
end
rows > @max_rows ? @max_rows : rows
end
......
@subjects = '' unless options[:only] == :lines
@lines = '' unless options[:only] == :subjects
@number_of_rows = 0
if @project
render_project(@project, options)
else
Project.roots.visible.has_module('issue_tracking').each do |project|
render_project(project, options)
break if abort?
end
project_list().each do |project|
render_project(project, options)
break if abort?
end
@subjects_rendered = true unless options[:only] == :lines
(2-2/2)