Browse Source

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
tags/1.4.0
Etienne Massip 12 years ago
parent
commit
8612fa2fc1
1 changed files with 7 additions and 7 deletions
  1. 7
    7
      app/views/gantts/show.html.erb

+ 7
- 7
app/views/gantts/show.html.erb 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}"%>
@@ -107,10 +107,10 @@ if show_weeks
left = 0
height = (show_days ? header_heigth - 1 : header_heigth - 1 + g_height)
if @gantt.date_from.cwday == 1
# @date_from is monday
week_f = @gantt.date_from
# @date_from is monday
week_f = @gantt.date_from
else
# find next monday after @date_from
# 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
%>
@@ -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>

Loading…
Cancel
Save