@@ -39,21 +39,21 @@ headers_height = header_heigth
39
39
show_weeks = false
40
40
show_days = false
41
41
42
- if @gantt . zoom >1
42
+ if @gantt . zoom > 1
43
43
show_weeks = true
44
- headers_height = 2 * header_heigth
44
+ headers_height = 2 * header_heigth
45
45
if @gantt . zoom > 2
46
46
show_days = true
47
- headers_height = 3 * header_heigth
47
+ headers_height = 3 * header_heigth
48
48
end
49
49
end
50
50
51
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
53
53
54
54
@gantt . render ( :top => headers_height + 8 , :zoom => zoom , :g_width => g_width , :subject_width => subject_width )
55
55
56
- g_height = [ ( 20 * ( @gantt . number_of_rows + 6 ) ) + 150 , 206 ] . max
56
+ g_height = [ ( 20 * ( @gantt . number_of_rows + 6 ) ) + 150 , 206 ] . max
57
57
t_height = g_height + headers_height
58
58
59
59
@@ -80,7 +80,7 @@ t_height = g_height + headers_height
80
80
< td >
81
81
82
82
< div style ="position:relative;height:<%= t_height + 24 %> px;overflow:auto; ">
83
- < div style ="width:<%= g_width - 1 %> px;height:<%= headers_height %> px;background: #eee; " class ="gantt_hdr "> </ div >
83
+ < div style ="width:<%= g_width - 1 %> px;height:<%= headers_height %> px;background: #eee; " class ="gantt_hdr "> </ div >
84
84
<%
85
85
#
86
86
# Months headers
@@ -89,7 +89,7 @@ month_f = @gantt.date_from
89
89
left = 0
90
90
height = ( show_weeks ? header_heigth : header_heigth + g_height )
91
91
@gantt . months . times do
92
- width = ( ( month_f >> 1 ) - month_f ) * zoom - 1
92
+ width = ( ( month_f >> 1 ) - month_f ) . to_i * zoom - 1
93
93
%>
94
94
< div style ="left:<%= left %> px;width:<%= width %> px;height:<%= height %> px; " class ="gantt_hdr ">
95
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 } " %>
@@ -105,29 +105,29 @@ end %>
105
105
#
106
106
if show_weeks
107
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
109
if @gantt . date_from . cwday == 1
110
110
# @date_from is monday
111
111
week_f = @gantt . date_from
112
112
else
113
113
# find next monday after @date_from
114
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
%>
117
117
< div style ="left:<%= left %> px;top:19px;width:<%= width %> px;height:<%= height %> px; " class ="gantt_hdr "> </ div >
118
118
<%
119
- left = left + width + 1
119
+ left = left + width + 1
120
120
end %>
121
121
<%
122
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
124
124
%>
125
125
< div style ="left:<%= left %> px;top:19px;width:<%= width %> px;height:<%= height %> px; " class ="gantt_hdr ">
126
126
< small > <%= week_f . cweek if width >= 16 %> </ small >
127
127
</ div >
128
128
<%
129
- left = left + width + 1
130
- week_f = week_f + 7
129
+ left = left + width + 1
130
+ week_f = week_f + 7
131
131
end
132
132
end %>
133
133
@@ -146,7 +146,7 @@ if show_days
146
146
<%= day_name ( wday ) . first %>
147
147
</ div >
148
148
<%
149
- left = left + width + 1
149
+ left = left + width + 1
150
150
wday = wday + 1
151
151
wday = 1 if wday > 7
152
152
end
@@ -159,7 +159,7 @@ end %>
159
159
# Today red line (excluded from cache)
160
160
#
161
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 %> px;width:10px;border-left: 1px dashed red; "> </ div >
163
163
<% end %>
164
164
165
165
</ div >
0 commit comments