##// END OF EJS Templates
code layout clean up app/views/gantts/show.html.erb...
Toshi MARUYAMA -
r7991:fd32f7446da9
parent child
Show More
@@ -39,21 +39,21 headers_height = header_heigth
39 show_weeks = false
39 show_weeks = false
40 show_days = false
40 show_days = false
41
41
42 if @gantt.zoom >1
42 if @gantt.zoom > 1
43 show_weeks = true
43 show_weeks = true
44 headers_height = 2*header_heigth
44 headers_height = 2 * header_heigth
45 if @gantt.zoom > 2
45 if @gantt.zoom > 2
46 show_days = true
46 show_days = true
47 headers_height = 3*header_heigth
47 headers_height = 3 * header_heigth
48 end
48 end
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
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
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 t_height = g_height + headers_height
57 t_height = g_height + headers_height
58
58
59
59
@@ -80,7 +80,7 t_height = g_height + headers_height
80 <td>
80 <td>
81
81
82 <div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;">
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">&nbsp;</div>
83 <div style="width:<%= g_width - 1 %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr">&nbsp;</div>
84 <%
84 <%
85 #
85 #
86 # Months headers
86 # Months headers
@@ -105,29 +105,29 end %>
105 #
105 #
106 if show_weeks
106 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 # @date_from is monday
110 # @date_from is monday
111 week_f = @gantt.date_from
111 week_f = @gantt.date_from
112 else
112 else
113 # find next monday after @date_from
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 %>
117 <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">&nbsp;</div>
117 <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">&nbsp;</div>
118 <%
118 <%
119 left = left + width+1
119 left = left + width + 1
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
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>
127 </div>
127 </div>
128 <%
128 <%
129 left = left + width+1
129 left = left + width + 1
130 week_f = week_f+7
130 week_f = week_f + 7
131 end
131 end
132 end %>
132 end %>
133
133
@@ -146,7 +146,7 if show_days
146 <%= day_name(wday).first %>
146 <%= day_name(wday).first %>
147 </div>
147 </div>
148 <%
148 <%
149 left = left + width+1
149 left = left + width + 1
150 wday = wday + 1
150 wday = wday + 1
151 wday = 1 if wday > 7
151 wday = 1 if wday > 7
152 end
152 end
@@ -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;">&nbsp;</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;">&nbsp;</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