@@ -49,7 +49,7 if @gantt.zoom > 1 | |||||
49 | end |
|
49 | end | |
50 |
|
50 | |||
51 | # Width of the entire chart |
|
51 | # Width of the entire chart | |
52 | g_width = (@gantt.date_to - @gantt.date_from + 1) * zoom |
|
52 | g_width = ((@gantt.date_to - @gantt.date_from + 1) * zoom).to_i | |
53 |
|
53 | |||
54 | @gantt.render(:top => headers_height + 8, :zoom => zoom, :g_width => g_width, :subject_width => subject_width) |
|
54 | @gantt.render(:top => headers_height + 8, :zoom => zoom, :g_width => g_width, :subject_width => subject_width) | |
55 |
|
55 | |||
@@ -89,7 +89,7 month_f = @gantt.date_from | |||||
89 | left = 0 |
|
89 | left = 0 | |
90 | height = (show_weeks ? header_heigth : header_heigth + g_height) |
|
90 | height = (show_weeks ? header_heigth : header_heigth + g_height) | |
91 | @gantt.months.times do |
|
91 | @gantt.months.times do | |
92 | width = ((month_f >> 1) - month_f) * zoom - 1 |
|
92 | width = (((month_f >> 1) - month_f) * zoom - 1).to_i | |
93 | %> |
|
93 | %> | |
94 | <div style="left:<%= left %>px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr"> |
|
94 | <div style="left:<%= left %>px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr"> | |
95 | <%= 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}"%> |
|
95 | <%= 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 | |||||
107 | left = 0 |
|
107 | left = 0 | |
108 | height = (show_days ? header_heigth - 1 : header_heigth - 1 + g_height) |
|
108 | height = (show_days ? header_heigth - 1 : header_heigth - 1 + g_height) | |
109 | if @gantt.date_from.cwday == 1 |
|
109 | if @gantt.date_from.cwday == 1 | |
110 |
|
|
110 | # @date_from is monday | |
111 |
|
|
111 | week_f = @gantt.date_from | |
112 | else |
|
112 | else | |
113 |
|
|
113 | # find next monday after @date_from | |
114 | week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1) |
|
114 | week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1) | |
115 | width = (7 - @gantt.date_from.cwday + 1) * zoom - 1 |
|
115 | width = (7 - @gantt.date_from.cwday + 1) * zoom - 1 | |
116 | %> |
|
116 | %> | |
@@ -120,7 +120,7 if show_weeks | |||||
120 | end %> |
|
120 | end %> | |
121 | <% |
|
121 | <% | |
122 | while week_f <= @gantt.date_to |
|
122 | while week_f <= @gantt.date_to | |
123 | width = (week_f + 6 <= @gantt.date_to) ? 7 * zoom - 1 : (@gantt.date_to - week_f + 1) * zoom - 1 |
|
123 | width = ((week_f + 6 <= @gantt.date_to) ? 7 * zoom - 1 : (@gantt.date_to - week_f + 1) * zoom - 1).to_i | |
124 | %> |
|
124 | %> | |
125 | <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr"> |
|
125 | <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr"> | |
126 | <small><%= week_f.cweek if width >= 16 %></small> |
|
126 | <small><%= week_f.cweek if width >= 16 %></small> | |
@@ -159,7 +159,7 end %> | |||||
159 | # Today red line (excluded from cache) |
|
159 | # Today red line (excluded from cache) | |
160 | # |
|
160 | # | |
161 | if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %> |
|
161 | if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %> | |
162 | <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;"> </div> |
|
162 | <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;"> </div> | |
163 | <% end %> |
|
163 | <% end %> | |
164 |
|
164 | |||
165 | </div> |
|
165 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now