Last active
April 5, 2016 11:59
-
-
Save ShinichiU/4524693 to your computer and use it in GitHub Desktop.
Redmine 2.2.1 のガントチャートに週表示を消して日付表示にするバッチ
This file contains 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
diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb | |
index 0cebd0a..af74a18 100644 | |
--- a/app/views/gantts/show.html.erb | |
+++ b/app/views/gantts/show.html.erb | |
@@ -43,12 +43,17 @@ | |
headers_height = header_height | |
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_height | |
if @gantt.zoom > 2 | |
+ show_week_day_top = false | |
+ show_day_num = true | |
show_days = true | |
headers_height = 3 * header_height | |
end | |
@@ -137,7 +142,7 @@ | |
<% end %> | |
<% ###### Weeks headers ###### %> | |
-<% if show_weeks %> | |
+<% if show_week_day_top %> | |
<% | |
left = 0 | |
height = (show_days ? header_height - 1 : header_height - 1 + g_height) | |
@@ -175,7 +180,7 @@ | |
%> | |
<%= content_tag(:div, :style => style, :class => "gantt_hdr") do %> | |
<%= content_tag(:small) do %> | |
- <%= week_f.cweek if width >= 16 %> | |
+ <%= week_f.day if width >= 16 %> | |
<% end %> | |
<% end %> | |
<% | |
@@ -185,6 +190,28 @@ | |
<% end %> | |
<% end %> | |
+<% ###### Days Num headers ###### %> | |
+<% if show_day_num %> | |
+ <% | |
+ left = 0 | |
+ height = g_height + header_height + 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
コメント有難うございます
なおしました