From 0486ce99762d17962734f399dce8df8333114cea Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Fri, 7 Sep 2012 11:59:34 +0000 Subject: [PATCH] code layout cleanup gantt weeks headers git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10312 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/gantts/show.html.erb | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb index 076b6c761..5675ed8e1 100644 --- a/app/views/gantts/show.html.erb +++ b/app/views/gantts/show.html.erb @@ -115,34 +115,38 @@ height = (show_weeks ? header_heigth : header_heigth + g_height) # # Weeks headers # -if show_weeks +%> +<% if show_weeks %> + <% left = 0 height = (show_days ? header_heigth - 1 : header_heigth - 1 + g_height) - if @gantt.date_from.cwday == 1 + %> + <% if @gantt.date_from.cwday == 1 %> + <% # @date_from is monday week_f = @gantt.date_from - else + %> + <% else %> + <% # find next monday after @date_from week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1) width = (7 - @gantt.date_from.cwday + 1) * zoom - 1 %>
 
- <% - left = left + width + 1 - end %> - <% - while week_f <= @gantt.date_to - width = ((week_f + 6 <= @gantt.date_to) ? 7 * zoom - 1 : (@gantt.date_to - week_f + 1) * zoom - 1).to_i - %> -
- <%= week_f.cweek if width >= 16 %> -
+ <% left = left + width + 1 %> + <% end %> + <% while week_f <= @gantt.date_to %> + <% width = ((week_f + 6 <= @gantt.date_to) ? 7 * zoom - 1 : (@gantt.date_to - week_f + 1) * zoom - 1).to_i %> +
+ <%= week_f.cweek if width >= 16 %> +
<% left = left + width + 1 week_f = week_f + 7 - end -end %> + %> + <% end %> +<% end %> <% # -- 2.39.5