Created
July 13, 2012 21:51
-
-
Save uskanda/3107779 to your computer and use it in GitHub Desktop.
Gantt with date display patch for Redmine 2.0.3.stable.9920
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- show.html.erb.org 2012-07-14 06:22:37.254627009 +0900 | |
+++ show.html.erb 2012-07-14 06:33:37.010631122 +0900 | |
@@ -41,6 +41,7 @@ | |
headers_height = header_heigth | |
show_weeks = false | |
show_days = false | |
+show_day_num = false | |
if @gantt.zoom > 1 | |
show_weeks = true | |
@@ -48,6 +49,10 @@ | |
if @gantt.zoom > 2 | |
show_days = true | |
headers_height = 3 * header_heigth | |
+ if @gantt.zoom > 3 | |
+ show_day_num = true | |
+ headers_height = 4 * header_heigth | |
+ end | |
end | |
end | |
@@ -136,16 +141,40 @@ | |
<% | |
# | |
+# Days headers Num | |
+# | |
+if show_day_num | |
+ left = 0 | |
+ height = g_height + header_heigth*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 | |
+%> | |
+ <div style="left:<%= left %>px;top:37px;width:<%= width %>px;height:<%= height %>px;font-size:0.7em;<%= "background:#f1f1f1;" if wday > 5 %><%= "color:blue;" if wday == 6 %><%= "color:red;" if wday == 7 %>" class="gantt_hdr"> | |
+ <%= day_num.day %> | |
+ </div> | |
+ <% | |
+ 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_heigth - 1 | |
+ top = (show_day_num ? 55 : 37) | |
wday = @gantt.date_from.cwday | |
(@gantt.date_to - @gantt.date_from + 1).to_i.times do | |
width = zoom - 1 | |
%> | |
- <div style="left:<%= left %>px;top:37px;width:<%= width %>px;height:<%= height %>px;font-size:0.7em;<%= "background:#f1f1f1;" if wday > 5 %>" class="gantt_hdr"> | |
+ <div style="left:<%= left %>px;top:<%= top %>px;width:<%= width %>px;height:<%= height %>px;font-size:0.7em;<%= "background:#f1f1f1;" if wday > 5 %>" class="gantt_hdr"> | |
<%= day_name(wday).first %> | |
</div> | |
<% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment