diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-04-07 12:09:01 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-04-07 12:09:01 +0000 |
commit | 708c3c9ec6efd8359efe450371ac818d406f6fd4 (patch) | |
tree | 9f17647e6c6f97fcbdb365d5c215f35de85c2f7d /app/views | |
parent | c1a5c5b9f8720f7cf0998d649e9b4a67c52057de (diff) | |
download | redmine-708c3c9ec6efd8359efe450371ac818d406f6fd4.tar.gz redmine-708c3c9ec6efd8359efe450371ac818d406f6fd4.zip |
Added versions due dates on gantt chart.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@428 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/projects/gantt.rfpdf | 81 | ||||
-rw-r--r-- | app/views/projects/gantt.rhtml | 28 |
2 files changed, 70 insertions, 39 deletions
diff --git a/app/views/projects/gantt.rfpdf b/app/views/projects/gantt.rfpdf index 6f85ce742..f5e64b1b3 100644 --- a/app/views/projects/gantt.rfpdf +++ b/app/views/projects/gantt.rfpdf @@ -106,51 +106,70 @@ pdf.Cell(subject_width+g_width-15, headers_heigth, "", 1) #
top = headers_heigth + y_start
pdf.SetFontStyle('B',7)
-@issues.each do |i|
+@events.each do |i|
pdf.SetY(top)
pdf.SetX(15)
- pdf.Cell(subject_width-15, 5, "#{i.tracker.name} #{i.id}: #{i.subject}".sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)'), "LR")
+
+ if i.is_a? Issue
+ pdf.Cell(subject_width-15, 5, "#{i.tracker.name} #{i.id}: #{i.subject}".sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)'), "LR")
+ else
+ pdf.Cell(subject_width-15, 5, "#{l(:label_version)}: #{i.name}", "LR")
+ end
pdf.SetY(top)
pdf.SetX(subject_width)
pdf.Cell(g_width, 5, "", "LR")
+
+ pdf.SetY(top+1.5)
- i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from )
- i_end_date = (i.due_date <= @date_to ? i.due_date : @date_to )
-
- i_done_date = i.start_date + ((i.due_date - i.start_date+1)*i.done_ratio/100).floor
- i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date )
- i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date )
+ if i.is_a? Issue
+ i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from )
+ i_end_date = (i.due_date <= @date_to ? i.due_date : @date_to )
+
+ i_done_date = i.start_date + ((i.due_date - i.start_date+1)*i.done_ratio/100).floor
+ i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date )
+ i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date )
+
+ i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today
+
+ i_left = ((i_start_date - @date_from)*zoom)
+ i_width = ((i_end_date - i_start_date + 1)*zoom)
+ d_width = ((i_done_date - i_start_date)*zoom)
+ l_width = ((i_late_date - i_start_date+1)*zoom) if i_late_date
+ l_width ||= 0
- i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today
+ pdf.SetX(subject_width + i_left)
+ pdf.SetFillColor(200,200,200)
+ pdf.Cell(i_width, 2, "", 0, 0, "", 1)
- i_left = ((i_start_date - @date_from)*zoom)
- i_width = ((i_end_date - i_start_date + 1)*zoom)
- d_width = ((i_done_date - i_start_date)*zoom)
- l_width = ((i_late_date - i_start_date+1)*zoom) if i_late_date
- l_width ||= 0
-
- pdf.SetY(top+1.5)
- pdf.SetX(subject_width + i_left)
- pdf.SetFillColor(200,200,200)
- pdf.Cell(i_width, 2, "", 0, 0, "", 1)
-
- if l_width > 0
+ if l_width > 0
+ pdf.SetY(top+1.5)
+ pdf.SetX(subject_width + i_left)
+ pdf.SetFillColor(255,100,100)
+ pdf.Cell(l_width, 2, "", 0, 0, "", 1)
+ end
+ if d_width > 0
+ pdf.SetY(top+1.5)
+ pdf.SetX(subject_width + i_left)
+ pdf.SetFillColor(100,100,255)
+ pdf.Cell(d_width, 2, "", 0, 0, "", 1)
+ end
+
pdf.SetY(top+1.5)
+ pdf.SetX(subject_width + i_left + i_width)
+ pdf.Cell(30, 2, "#{i.status.name} #{i.done_ratio}%")
+ else
+ i_left = ((i.start_date - @date_from)*zoom)
+
pdf.SetX(subject_width + i_left)
- pdf.SetFillColor(255,100,100)
- pdf.Cell(l_width, 2, "", 0, 0, "", 1)
- end
- if d_width > 0
+ pdf.SetFillColor(50,200,50)
+ pdf.Cell(2, 2, "", 0, 0, "", 1)
+
pdf.SetY(top+1.5)
- pdf.SetX(subject_width + i_left)
- pdf.SetFillColor(100,100,255)
- pdf.Cell(d_width, 2, "", 0, 0, "", 1)
+ pdf.SetX(subject_width + i_left + 3)
+ pdf.Cell(30, 2, "#{i.name}")
end
- pdf.SetY(top+1.5)
- pdf.SetX(subject_width + i_left + i_width)
- pdf.Cell(30, 2, "#{i.status.name} #{i.done_ratio}%")
top = top + 5
pdf.SetDrawColor(200, 200, 200)
diff --git a/app/views/projects/gantt.rhtml b/app/views/projects/gantt.rhtml index 8c6c5b635..4a10a7b4c 100644 --- a/app/views/projects/gantt.rhtml +++ b/app/views/projects/gantt.rhtml @@ -67,7 +67,7 @@ if @zoom >1 end g_width = (@date_to - @date_from + 1)*zoom -g_height = [(20 * @issues.length + 6)+150, 206].max +g_height = [(20 * @events.length + 6)+150, 206].max t_height = g_height + headers_height %> @@ -83,11 +83,15 @@ t_height = g_height + headers_height # Tasks subjects # top = headers_height + 8 -@issues.each do |i| %> - <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"> - <small><%= link_to "#{i.tracker.name} ##{i.id}", { :controller => 'issues', :action => 'show', :id => i }, :title => "#{i.subject}" %>: - <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small> - </div> +@events.each do |i| %> + <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"><small> + <% if i.is_a? Issue %> + <%= link_to "#{i.tracker.name} ##{i.id}", { :controller => 'issues', :action => 'show', :id => i }, :title => "#{i.subject}" %>: + <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %> + <% else %> + <strong><%= "#{l(:label_version)}: #{i.name}" %></strong> + <% end %> + </small></div> <% top = top + 20 end %> </div> @@ -180,8 +184,8 @@ if Date.today >= @date_from and Date.today <= @date_to %> # Tasks # top = headers_height + 10 -@issues.each do |i| %> - <% +@events.each do |i| + if i.is_a? Issue i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from ) i_end_date = (i.due_date <= @date_to ? i.due_date : @date_to ) @@ -212,6 +216,14 @@ top = headers_height + 10 <span class="tip"> <%= render :partial => "issues/tooltip", :locals => { :issue => i }%> </span></div> +<% else + i_left = ((i.start_date - @date_from)*zoom).floor + %> + <div style="top:<%= top %>px;left:<%= i_left %>px;width:15px;" class="task milestone"> </div> + <div style="top:<%= top %>px;left:<%= i_left + 12 %>px;background:#fff;" class="task"> + <strong><%= i.name %></strong> + </div> +<% end %> <% top = top + 20 end %> </div> |