Fixed Gantt months/weeks/days headers display with Ruby 1.9.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9175 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Etienne Massip 2012-03-10 15:10:32 +00:00
parent 934dd07fa7
commit 8612fa2fc1
1 changed files with 7 additions and 7 deletions

View File

@ -49,7 +49,7 @@ if @gantt.zoom > 1
end
# Width of the entire chart
g_width = (@gantt.date_to - @gantt.date_from + 1) * zoom
g_width = ((@gantt.date_to - @gantt.date_from + 1) * zoom).to_i
@gantt.render(:top => headers_height + 8, :zoom => zoom, :g_width => g_width, :subject_width => subject_width)
@ -89,7 +89,7 @@ month_f = @gantt.date_from
left = 0
height = (show_weeks ? header_heigth : header_heigth + g_height)
@gantt.months.times do
width = ((month_f >> 1) - month_f) * zoom - 1
width = (((month_f >> 1) - month_f) * zoom - 1).to_i
%>
<div style="left:<%= left %>px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">
<%= link_to h("#{month_f.year}-#{month_f.month}"), @gantt.params.merge(:year => month_f.year, :month => month_f.month), :title => "#{month_name(month_f.month)} #{month_f.year}"%>
@ -120,7 +120,7 @@ if show_weeks
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
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">
<small><%= week_f.cweek if width >= 16 %></small>
@ -159,7 +159,7 @@ end %>
# Today red line (excluded from cache)
#
if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %>
<div style="position: absolute;height:<%= g_height %>px;top:<%= headers_height + 1 %>px;left:<%= ((Date.today - @gantt.date_from + 1) * zoom).floor() - 1 %>px;width:10px;border-left: 1px dashed red;">&nbsp;</div>
<div style="position: absolute;height:<%= g_height %>px;top:<%= headers_height + 1 %>px;left:<%= (((Date.today - @gantt.date_from + 1) * zoom).floor() - 1).to_i %>px;width:10px;border-left: 1px dashed red;">&nbsp;</div>
<% end %>
</div>