Skip to content

Instantly share code, notes, and snippets.

@ShinichiU
Created December 30, 2011 22:45
Show Gist options
  • Save ShinichiU/1541884 to your computer and use it in GitHub Desktop.
Save ShinichiU/1541884 to your computer and use it in GitHub Desktop.
Redmine 1.3.0 のガントチャートに週表示を消して日付表示にするバッチ
Index: app/views/gantts/show.html.erb
===================================================================
--- app/views/gantts/show.html.erb (リビジョン 8442)
+++ app/views/gantts/show.html.erb (作業コピー)
@@ -37,12 +37,17 @@
headers_height = header_heigth
show_weeks = false
+show_week_day_top = false
show_days = false
+show_day_num = false
if @gantt.zoom >1
show_weeks = true
+ show_week_day_top = true
headers_height = 2*header_heigth
if @gantt.zoom > 2
+ show_week_day_top = false
+ show_day_num = true
show_days = true
headers_height = 3*header_heigth
end
@@ -101,9 +106,9 @@
<%
#
-# Weeks headers
+# Show Week Day Top headers
#
-if show_weeks
+if show_week_day_top
left = 0
height = (show_days ? header_heigth-1 : header_heigth-1 + g_height)
if @gantt.date_from.cwday == 1
@@ -123,7 +128,7 @@
width = (week_f + 6 <= @gantt.date_to) ? 7 * zoom -1 : (@gantt.date_to - week_f + 1) * zoom-1
%>
<div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">
- <small><%= week_f.cweek if width >= 16 %></small>
+ <small><%= week_f.day if width >= 16 %></small>
</div>
<%
left = left + width+1
@@ -133,11 +138,35 @@
<%
#
+# Days Num headers
+#
+if show_day_num
+ left = 0
+ height = g_height + header_heigth + 17
+ 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:19px;width:<%= width %>px;height:<%= height %>px;font-size:0.7em;<%= "background:#f1f1f1;" if wday > 5 %>" 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment