code layout cleanup gantt weeks headers

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10312 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2012-09-07 11:59:34 +00:00
parent 621b15c923
commit 0486ce9976
1 changed files with 19 additions and 15 deletions

View File

@ -115,34 +115,38 @@ height = (show_weeks ? header_heigth : header_heigth + g_height)
# #
# Weeks headers # Weeks headers
# #
if show_weeks %>
<% if show_weeks %>
<%
left = 0 left = 0
height = (show_days ? header_heigth - 1 : header_heigth - 1 + g_height) 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 # @date_from is monday
week_f = @gantt.date_from week_f = @gantt.date_from
else %>
<% else %>
<%
# find next monday after @date_from # find next monday after @date_from
week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1) week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1)
width = (7 - @gantt.date_from.cwday + 1) * zoom - 1 width = (7 - @gantt.date_from.cwday + 1) * zoom - 1
%> %>
<div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;"
class="gantt_hdr">&nbsp;</div> class="gantt_hdr">&nbsp;</div>
<% <% left = left + width + 1 %>
left = left + width + 1 <% end %>
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 %>
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
%>
<div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr"> <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.cweek if width >= 16 %></small>
</div> </div>
<% <%
left = left + width + 1 left = left + width + 1
week_f = week_f + 7 week_f = week_f + 7
end %>
end %> <% end %>
<% end %>
<% <%
# #