##// 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 headers_height = header_height
90 headers_height = header_height
91 show_weeks = false
91 show_weeks = false
92 show_days = false
92 show_days = false
93 show_day_num = false
93
94
94 if @gantt.zoom > 1
95 if @gantt.zoom > 1
95 show_weeks = true
96 show_weeks = true
@@ -97,6 +98,10
97 if @gantt.zoom > 2
98 if @gantt.zoom > 2
98 show_days = true
99 show_days = true
99 headers_height = 3 * header_height
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 end
105 end
101 end
106 end
102
107
@@ -231,11 +236,44
231 <% end %>
236 <% end %>
232 <% end %>
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 <% ###### Days headers ####### %>
271 <% ###### Days headers ####### %>
235 <% if show_days %>
272 <% if show_days %>
236 <%
273 <%
237 left = 0
274 left = 0
238 height = g_height + header_height - 1
275 height = g_height + header_height - 1
276 top = (show_day_num ? 55 : 37)
239 wday = @gantt.date_from.cwday
277 wday = @gantt.date_from.cwday
240 %>
278 %>
241 <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %>
279 <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %>
@@ -243,7 +281,7
243 width = zoom - 1
281 width = zoom - 1
244 style = ""
282 style = ""
245 style += "left: #{left}px;"
283 style += "left: #{left}px;"
246 style += "top:37px;"
284 style += "top: #{top}px;"
247 style += "width: #{width}px;"
285 style += "width: #{width}px;"
248 style += "height: #{height}px;"
286 style += "height: #{height}px;"
249 style += "font-size:0.7em;"
287 style += "font-size:0.7em;"
@@ -460,6 +460,10 module Redmine
460 if self.months < 3
460 if self.months < 3
461 show_days = true
461 show_days = true
462 headers_height = 3 * header_height
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 end
467 end
464 end
468 end
465 g_width = PDF.right_pane_width
469 g_width = PDF.right_pane_width
@@ -504,6 +508,25 module Redmine
504 week_f = week_f + 7
508 week_f = week_f + 7
505 end
509 end
506 end
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 # Days headers
530 # Days headers
508 if show_days
531 if show_days
509 left = subject_width
532 left = subject_width
@@ -512,8 +535,9 module Redmine
512 pdf.SetFontStyle('B', 7)
535 pdf.SetFontStyle('B', 7)
513 (self.date_to - self.date_from + 1).to_i.times do
536 (self.date_to - self.date_from + 1).to_i.times do
514 width = zoom
537 width = zoom
515 pdf.SetY(y_start + 2 * header_height)
538 pdf.SetY(y_start + header_height * (show_day_num ? 3 : 2))
516 pdf.SetX(left)
539 pdf.SetX(left)
540 pdf.SetTextColor(non_working_week_days.include?(wday) ? 150 : 0)
517 pdf.RDMCell(width, height, day_name(wday).first, "LTR", 0, "C")
541 pdf.RDMCell(width, height, day_name(wday).first, "LTR", 0, "C")
518 left = left + width
542 left = left + width
519 wday = wday + 1
543 wday = wday + 1
@@ -522,6 +546,7 module Redmine
522 end
546 end
523 pdf.SetY(y_start)
547 pdf.SetY(y_start)
524 pdf.SetX(15)
548 pdf.SetX(15)
549 pdf.SetTextColor(0)
525 pdf.RDMCell(subject_width + g_width - 15, headers_height, "", 1)
550 pdf.RDMCell(subject_width + g_width - 15, headers_height, "", 1)
526 # Tasks
551 # Tasks
527 top = headers_height + y_start
552 top = headers_height + y_start
@@ -967,7 +967,7 a.close-icon:hover {background-image:url('../images/close_hl.png');}
967 overflow: hidden;
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 .gantt_subjects { font-size: 0.8em; }
972 .gantt_subjects { font-size: 0.8em; }
973 .gantt_subjects div { line-height:16px;height:16px;overflow:hidden;white-space:nowrap;text-overflow: ellipsis; }
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