##// END OF EJS Templates
Adds day numbers to HTML and PDF gantt (#3034)....
Jean-Philippe Lang -
r14256:f9425cbaf37e
parent child
Show More
@@ -90,6 +90,7
90 90 headers_height = header_height
91 91 show_weeks = false
92 92 show_days = false
93 show_day_num = false
93 94
94 95 if @gantt.zoom > 1
95 96 show_weeks = true
@@ -97,6 +98,10
97 98 if @gantt.zoom > 2
98 99 show_days = true
99 100 headers_height = 3 * header_height
101 if @gantt.zoom > 3
102 show_day_num = true
103 headers_height = 4 * header_height
104 end
100 105 end
101 106 end
102 107
@@ -231,11 +236,44
231 236 <% end %>
232 237 <% end %>
233 238
239 <% ###### Day numbers headers ###### %>
240 <% if show_day_num %>
241 <%
242 left = 0
243 height = g_height + header_height*2 - 1
244 wday = @gantt.date_from.cwday
245 day_num = @gantt.date_from
246 %>
247 <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %>
248 <%
249 width = zoom - 1
250 style = ""
251 style += "left:#{left}px;"
252 style += "top:37px;"
253 style += "width:#{width}px;"
254 style += "height:#{height}px;"
255 style += "font-size:0.7em;"
256 clss = "gantt_hdr"
257 clss << " nwday" if @gantt.non_working_week_days.include?(wday)
258 %>
259 <%= content_tag(:div, :style => style, :class => clss) do %>
260 <%= day_num.day %>
261 <% end %>
262 <%
263 left = left + width+1
264 day_num = day_num + 1
265 wday = wday + 1
266 wday = 1 if wday > 7
267 %>
268 <% end %>
269 <% end %>
270
234 271 <% ###### Days headers ####### %>
235 272 <% if show_days %>
236 273 <%
237 274 left = 0
238 275 height = g_height + header_height - 1
276 top = (show_day_num ? 55 : 37)
239 277 wday = @gantt.date_from.cwday
240 278 %>
241 279 <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %>
@@ -243,7 +281,7
243 281 width = zoom - 1
244 282 style = ""
245 283 style += "left: #{left}px;"
246 style += "top:37px;"
284 style += "top: #{top}px;"
247 285 style += "width: #{width}px;"
248 286 style += "height: #{height}px;"
249 287 style += "font-size:0.7em;"
@@ -460,6 +460,10 module Redmine
460 460 if self.months < 3
461 461 show_days = true
462 462 headers_height = 3 * header_height
463 if self.months < 2
464 show_day_num = true
465 headers_height = 4 * header_height
466 end
463 467 end
464 468 end
465 469 g_width = PDF.right_pane_width
@@ -504,6 +508,25 module Redmine
504 508 week_f = week_f + 7
505 509 end
506 510 end
511 # Day numbers headers
512 if show_day_num
513 left = subject_width
514 height = header_height
515 day_num = self.date_from
516 wday = self.date_from.cwday
517 pdf.SetFontStyle('B', 7)
518 (self.date_to - self.date_from + 1).to_i.times do
519 width = zoom
520 pdf.SetY(y_start + header_height * 2)
521 pdf.SetX(left)
522 pdf.SetTextColor(non_working_week_days.include?(wday) ? 150 : 0)
523 pdf.RDMCell(width, height, day_num.day.to_s, "LTR", 0, "C")
524 left = left + width
525 day_num = day_num + 1
526 wday = wday + 1
527 wday = 1 if wday > 7
528 end
529 end
507 530 # Days headers
508 531 if show_days
509 532 left = subject_width
@@ -512,8 +535,9 module Redmine
512 535 pdf.SetFontStyle('B', 7)
513 536 (self.date_to - self.date_from + 1).to_i.times do
514 537 width = zoom
515 pdf.SetY(y_start + 2 * header_height)
538 pdf.SetY(y_start + header_height * (show_day_num ? 3 : 2))
516 539 pdf.SetX(left)
540 pdf.SetTextColor(non_working_week_days.include?(wday) ? 150 : 0)
517 541 pdf.RDMCell(width, height, day_name(wday).first, "LTR", 0, "C")
518 542 left = left + width
519 543 wday = wday + 1
@@ -522,6 +546,7 module Redmine
522 546 end
523 547 pdf.SetY(y_start)
524 548 pdf.SetX(15)
549 pdf.SetTextColor(0)
525 550 pdf.RDMCell(subject_width + g_width - 15, headers_height, "", 1)
526 551 # Tasks
527 552 top = headers_height + y_start
@@ -967,7 +967,7 a.close-icon:hover {background-image:url('../images/close_hl.png');}
967 967 overflow: hidden;
968 968 }
969 969
970 .gantt_hdr.nwday {background-color:#f1f1f1;}
970 .gantt_hdr.nwday {background-color:#f1f1f1; color:#999;}
971 971
972 972 .gantt_subjects { font-size: 0.8em; }
973 973 .gantt_subjects div { line-height:16px;height:16px;overflow:hidden;white-space:nowrap;text-overflow: ellipsis; }
General Comments 0
You need to be logged in to leave comments. Login now