summaryrefslogtreecommitdiffstats
path: root/app/views/gantts/show.html.erb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-10-03 09:10:27 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-10-03 09:10:27 +0000
commitf9425cbaf37ea67b69494605fea3f2836c70a48c (patch)
tree095dc35a9385092c3ead66321932bbea51f2bea3 /app/views/gantts/show.html.erb
parentca2f109cfbc2f0d8b40dc115c51981241c4da915 (diff)
downloadredmine-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 'app/views/gantts/show.html.erb')
-rw-r--r--app/views/gantts/show.html.erb40
1 files changed, 39 insertions, 1 deletions
diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb
index ada60cd66..dc89b2090 100644
--- a/app/views/gantts/show.html.erb
+++ b/app/views/gantts/show.html.erb
@@ -90,6 +90,7 @@
headers_height = header_height
show_weeks = false
show_days = false
+ show_day_num = false
if @gantt.zoom > 1
show_weeks = true
@@ -97,6 +98,10 @@
if @gantt.zoom > 2
show_days = true
headers_height = 3 * header_height
+ if @gantt.zoom > 3
+ show_day_num = true
+ headers_height = 4 * header_height
+ end
end
end
@@ -231,11 +236,44 @@
<% end %>
<% end %>
+<% ###### Day numbers headers ###### %>
+<% if show_day_num %>
+ <%
+ left = 0
+ height = g_height + header_height*2 - 1
+ wday = @gantt.date_from.cwday
+ day_num = @gantt.date_from
+ %>
+ <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %>
+ <%
+ width = zoom - 1
+ style = ""
+ style += "left:#{left}px;"
+ style += "top:37px;"
+ style += "width:#{width}px;"
+ style += "height:#{height}px;"
+ style += "font-size:0.7em;"
+ clss = "gantt_hdr"
+ clss << " nwday" if @gantt.non_working_week_days.include?(wday)
+ %>
+ <%= content_tag(:div, :style => style, :class => clss) do %>
+ <%= day_num.day %>
+ <% end %>
+ <%
+ left = left + width+1
+ day_num = day_num + 1
+ wday = wday + 1
+ wday = 1 if wday > 7
+ %>
+ <% end %>
+<% end %>
+
<% ###### Days headers ####### %>
<% if show_days %>
<%
left = 0
height = g_height + header_height - 1
+ top = (show_day_num ? 55 : 37)
wday = @gantt.date_from.cwday
%>
<% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %>
@@ -243,7 +281,7 @@
width = zoom - 1
style = ""
style += "left: #{left}px;"
- style += "top:37px;"
+ style += "top: #{top}px;"
style += "width: #{width}px;"
style += "height: #{height}px;"
style += "font-size:0.7em;"