Last active
April 27, 2016 10:36
-
-
Save ShinichiU/5689768 to your computer and use it in GitHub Desktop.
Redmine 2.3.1 のガントチャートに週表示を消して日付表示にするバッチ
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
Index: app/views/gantts/show.html.erb | |
=================================================================== | |
--- app/views/gantts/show.html.erb (リビジョン 11915) | |
+++ app/views/gantts/show.html.erb (作業コピー) | |
@@ -76,12 +76,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 | |
@@ -170,7 +175,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) | |
@@ -208,7 +213,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 %> | |
<% | |
@@ -218,6 +223,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
2.4.x でも使えそう