diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-10-03 09:10:27 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-10-03 09:10:27 +0000 |
commit | f9425cbaf37ea67b69494605fea3f2836c70a48c (patch) | |
tree | 095dc35a9385092c3ead66321932bbea51f2bea3 /lib/redmine/helpers/gantt.rb | |
parent | ca2f109cfbc2f0d8b40dc115c51981241c4da915 (diff) | |
download | redmine-f9425cbaf37ea67b69494605fea3f2836c70a48c.tar.gz redmine-f9425cbaf37ea67b69494605fea3f2836c70a48c.zip |
Adds day numbers to HTML and PDF gantt (#3034).
git-svn-id: http://svn.redmine.org/redmine/trunk@14638 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/helpers/gantt.rb')
-rw-r--r-- | lib/redmine/helpers/gantt.rb | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index f2342efeb..d551112a1 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.rb @@ -460,6 +460,10 @@ module Redmine if self.months < 3 show_days = true headers_height = 3 * header_height + if self.months < 2 + show_day_num = true + headers_height = 4 * header_height + end end end g_width = PDF.right_pane_width @@ -504,6 +508,25 @@ module Redmine week_f = week_f + 7 end end + # Day numbers headers + if show_day_num + left = subject_width + height = header_height + day_num = self.date_from + wday = self.date_from.cwday + pdf.SetFontStyle('B', 7) + (self.date_to - self.date_from + 1).to_i.times do + width = zoom + pdf.SetY(y_start + header_height * 2) + pdf.SetX(left) + pdf.SetTextColor(non_working_week_days.include?(wday) ? 150 : 0) + pdf.RDMCell(width, height, day_num.day.to_s, "LTR", 0, "C") + left = left + width + day_num = day_num + 1 + wday = wday + 1 + wday = 1 if wday > 7 + end + end # Days headers if show_days left = subject_width @@ -512,8 +535,9 @@ module Redmine pdf.SetFontStyle('B', 7) (self.date_to - self.date_from + 1).to_i.times do width = zoom - pdf.SetY(y_start + 2 * header_height) + pdf.SetY(y_start + header_height * (show_day_num ? 3 : 2)) pdf.SetX(left) + pdf.SetTextColor(non_working_week_days.include?(wday) ? 150 : 0) pdf.RDMCell(width, height, day_name(wday).first, "LTR", 0, "C") left = left + width wday = wday + 1 @@ -522,6 +546,7 @@ module Redmine end pdf.SetY(y_start) pdf.SetX(15) + pdf.SetTextColor(0) pdf.RDMCell(subject_width + g_width - 15, headers_height, "", 1) # Tasks top = headers_height + y_start |