##// END OF EJS Templates
fix typo "header_heigth" in gantt view...
Toshi MARUYAMA -
r11032:0e180c861fb3
parent child
Show More
@@ -1,319 +1,319
1 <% @gantt.view = self %>
1 <% @gantt.view = self %>
2 <h2><%= @query.new_record? ? l(:label_gantt) : h(@query.name) %></h2>
2 <h2><%= @query.new_record? ? l(:label_gantt) : h(@query.name) %></h2>
3
3
4 <%= form_tag({:controller => 'gantts', :action => 'show',
4 <%= form_tag({:controller => 'gantts', :action => 'show',
5 :project_id => @project, :month => params[:month],
5 :project_id => @project, :month => params[:month],
6 :year => params[:year], :months => params[:months]},
6 :year => params[:year], :months => params[:months]},
7 :method => :get, :id => 'query_form') do %>
7 :method => :get, :id => 'query_form') do %>
8 <%= hidden_field_tag 'set_filter', '1' %>
8 <%= hidden_field_tag 'set_filter', '1' %>
9 <fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
9 <fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
10 <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend>
10 <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend>
11 <div style="<%= @query.new_record? ? "" : "display: none;" %>">
11 <div style="<%= @query.new_record? ? "" : "display: none;" %>">
12 <%= render :partial => 'queries/filters', :locals => {:query => @query} %>
12 <%= render :partial => 'queries/filters', :locals => {:query => @query} %>
13 </div>
13 </div>
14 </fieldset>
14 </fieldset>
15 <fieldset class="collapsible collapsed">
15 <fieldset class="collapsible collapsed">
16 <legend onclick="toggleFieldset(this);"><%= l(:label_options) %></legend>
16 <legend onclick="toggleFieldset(this);"><%= l(:label_options) %></legend>
17 <div style="display: none;">
17 <div style="display: none;">
18 <table>
18 <table>
19 <tr>
19 <tr>
20 <td>
20 <td>
21 <fieldset>
21 <fieldset>
22 <legend><%= l(:label_related_issues) %></legend>
22 <legend><%= l(:label_related_issues) %></legend>
23 <label>
23 <label>
24 <%= check_box_tag "draw_rels", params["draw_rels"], true %>
24 <%= check_box_tag "draw_rels", params["draw_rels"], true %>
25 <% rels = [IssueRelation::TYPE_BLOCKS, IssueRelation::TYPE_PRECEDES] %>
25 <% rels = [IssueRelation::TYPE_BLOCKS, IssueRelation::TYPE_PRECEDES] %>
26 <% rels.each do |rel| %>
26 <% rels.each do |rel| %>
27 <% color = Redmine::Helpers::Gantt::DRAW_TYPES[rel][:color] %>
27 <% color = Redmine::Helpers::Gantt::DRAW_TYPES[rel][:color] %>
28 <%= content_tag(:span, '&nbsp;&nbsp;&nbsp;'.html_safe,
28 <%= content_tag(:span, '&nbsp;&nbsp;&nbsp;'.html_safe,
29 :style => "background-color: #{color}") %>
29 :style => "background-color: #{color}") %>
30 <%= l(IssueRelation::TYPES[rel][:name]) %>
30 <%= l(IssueRelation::TYPES[rel][:name]) %>
31 <% end %>
31 <% end %>
32 </label>
32 </label>
33 </fieldset>
33 </fieldset>
34 </td>
34 </td>
35 <td>
35 <td>
36 <fieldset>
36 <fieldset>
37 <legend><%= l(:label_gantt_progress_line) %></legend>
37 <legend><%= l(:label_gantt_progress_line) %></legend>
38 <label>
38 <label>
39 <%= check_box_tag "draw_progress_line", params[:draw_progress_line], false %>
39 <%= check_box_tag "draw_progress_line", params[:draw_progress_line], false %>
40 <%= l(:label_display) %>
40 <%= l(:label_display) %>
41 </label>
41 </label>
42 </fieldset>
42 </fieldset>
43 </td>
43 </td>
44 </tr>
44 </tr>
45 </table>
45 </table>
46 </div>
46 </div>
47 </fieldset>
47 </fieldset>
48
48
49 <p class="contextual">
49 <p class="contextual">
50 <%= gantt_zoom_link(@gantt, :in) %>
50 <%= gantt_zoom_link(@gantt, :in) %>
51 <%= gantt_zoom_link(@gantt, :out) %>
51 <%= gantt_zoom_link(@gantt, :out) %>
52 </p>
52 </p>
53
53
54 <p class="buttons">
54 <p class="buttons">
55 <%= text_field_tag 'months', @gantt.months, :size => 2 %>
55 <%= text_field_tag 'months', @gantt.months, :size => 2 %>
56 <%= l(:label_months_from) %>
56 <%= l(:label_months_from) %>
57 <%= select_month(@gantt.month_from, :prefix => "month", :discard_type => true) %>
57 <%= select_month(@gantt.month_from, :prefix => "month", :discard_type => true) %>
58 <%= select_year(@gantt.year_from, :prefix => "year", :discard_type => true) %>
58 <%= select_year(@gantt.year_from, :prefix => "year", :discard_type => true) %>
59 <%= hidden_field_tag 'zoom', @gantt.zoom %>
59 <%= hidden_field_tag 'zoom', @gantt.zoom %>
60
60
61 <%= link_to_function l(:button_apply), '$("#query_form").submit()',
61 <%= link_to_function l(:button_apply), '$("#query_form").submit()',
62 :class => 'icon icon-checked' %>
62 :class => 'icon icon-checked' %>
63 <%= link_to l(:button_clear), { :project_id => @project, :set_filter => 1 },
63 <%= link_to l(:button_clear), { :project_id => @project, :set_filter => 1 },
64 :class => 'icon icon-reload' %>
64 :class => 'icon icon-reload' %>
65 </p>
65 </p>
66 <% end %>
66 <% end %>
67
67
68 <%= error_messages_for 'query' %>
68 <%= error_messages_for 'query' %>
69 <% if @query.valid? %>
69 <% if @query.valid? %>
70 <%
70 <%
71 zoom = 1
71 zoom = 1
72 @gantt.zoom.times { zoom = zoom * 2 }
72 @gantt.zoom.times { zoom = zoom * 2 }
73
73
74 subject_width = 330
74 subject_width = 330
75 header_heigth = 18
75 header_height = 18
76
76
77 headers_height = header_heigth
77 headers_height = header_height
78 show_weeks = false
78 show_weeks = false
79 show_days = false
79 show_days = false
80
80
81 if @gantt.zoom > 1
81 if @gantt.zoom > 1
82 show_weeks = true
82 show_weeks = true
83 headers_height = 2 * header_heigth
83 headers_height = 2 * header_height
84 if @gantt.zoom > 2
84 if @gantt.zoom > 2
85 show_days = true
85 show_days = true
86 headers_height = 3 * header_heigth
86 headers_height = 3 * header_height
87 end
87 end
88 end
88 end
89
89
90 # Width of the entire chart
90 # Width of the entire chart
91 g_width = ((@gantt.date_to - @gantt.date_from + 1) * zoom).to_i
91 g_width = ((@gantt.date_to - @gantt.date_from + 1) * zoom).to_i
92 @gantt.render(:top => headers_height + 8,
92 @gantt.render(:top => headers_height + 8,
93 :zoom => zoom,
93 :zoom => zoom,
94 :g_width => g_width,
94 :g_width => g_width,
95 :subject_width => subject_width)
95 :subject_width => subject_width)
96 g_height = [(20 * (@gantt.number_of_rows + 6)) + 150, 206].max
96 g_height = [(20 * (@gantt.number_of_rows + 6)) + 150, 206].max
97 t_height = g_height + headers_height
97 t_height = g_height + headers_height
98 %>
98 %>
99
99
100 <% if @gantt.truncated %>
100 <% if @gantt.truncated %>
101 <p class="warning"><%= l(:notice_gantt_chart_truncated, :max => @gantt.max_rows) %></p>
101 <p class="warning"><%= l(:notice_gantt_chart_truncated, :max => @gantt.max_rows) %></p>
102 <% end %>
102 <% end %>
103
103
104 <table style="width:100%; border:0; border-collapse: collapse;">
104 <table style="width:100%; border:0; border-collapse: collapse;">
105 <tr>
105 <tr>
106 <td style="width:<%= subject_width %>px; padding:0px;">
106 <td style="width:<%= subject_width %>px; padding:0px;">
107 <%
107 <%
108 style = ""
108 style = ""
109 style += "position:relative;"
109 style += "position:relative;"
110 style += "height: #{t_height + 24}px;"
110 style += "height: #{t_height + 24}px;"
111 style += "width: #{subject_width + 1}px;"
111 style += "width: #{subject_width + 1}px;"
112 %>
112 %>
113 <%= content_tag(:div, :style => style) do %>
113 <%= content_tag(:div, :style => style) do %>
114 <%
114 <%
115 style = ""
115 style = ""
116 style += "right:-2px;"
116 style += "right:-2px;"
117 style += "width: #{subject_width}px;"
117 style += "width: #{subject_width}px;"
118 style += "height: #{headers_height}px;"
118 style += "height: #{headers_height}px;"
119 style += 'background: #eee;'
119 style += 'background: #eee;'
120 %>
120 %>
121 <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %>
121 <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %>
122 <%
122 <%
123 style = ""
123 style = ""
124 style += "right:-2px;"
124 style += "right:-2px;"
125 style += "width: #{subject_width}px;"
125 style += "width: #{subject_width}px;"
126 style += "height: #{t_height}px;"
126 style += "height: #{t_height}px;"
127 style += 'border-left: 1px solid #c0c0c0;'
127 style += 'border-left: 1px solid #c0c0c0;'
128 style += 'overflow: hidden;'
128 style += 'overflow: hidden;'
129 %>
129 %>
130 <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %>
130 <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %>
131 <%= content_tag(:div, :class => "gantt_subjects") do %>
131 <%= content_tag(:div, :class => "gantt_subjects") do %>
132 <%= @gantt.subjects.html_safe %>
132 <%= @gantt.subjects.html_safe %>
133 <% end %>
133 <% end %>
134 <% end %>
134 <% end %>
135 </td>
135 </td>
136
136
137 <td>
137 <td>
138 <div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;" id="gantt_area">
138 <div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;" id="gantt_area">
139 <%
139 <%
140 style = ""
140 style = ""
141 style += "width: #{g_width - 1}px;"
141 style += "width: #{g_width - 1}px;"
142 style += "height: #{headers_height}px;"
142 style += "height: #{headers_height}px;"
143 style += 'background: #eee;'
143 style += 'background: #eee;'
144 %>
144 %>
145 <%= content_tag(:div, '&nbsp;'.html_safe, :style => style, :class => "gantt_hdr") %>
145 <%= content_tag(:div, '&nbsp;'.html_safe, :style => style, :class => "gantt_hdr") %>
146
146
147 <% ###### Months headers ###### %>
147 <% ###### Months headers ###### %>
148 <%
148 <%
149 month_f = @gantt.date_from
149 month_f = @gantt.date_from
150 left = 0
150 left = 0
151 height = (show_weeks ? header_heigth : header_heigth + g_height)
151 height = (show_weeks ? header_height : header_height + g_height)
152 %>
152 %>
153 <% @gantt.months.times do %>
153 <% @gantt.months.times do %>
154 <%
154 <%
155 width = (((month_f >> 1) - month_f) * zoom - 1).to_i
155 width = (((month_f >> 1) - month_f) * zoom - 1).to_i
156 style = ""
156 style = ""
157 style += "left: #{left}px;"
157 style += "left: #{left}px;"
158 style += "width: #{width}px;"
158 style += "width: #{width}px;"
159 style += "height: #{height}px;"
159 style += "height: #{height}px;"
160 %>
160 %>
161 <%= content_tag(:div, :style => style, :class => "gantt_hdr") do %>
161 <%= content_tag(:div, :style => style, :class => "gantt_hdr") do %>
162 <%= link_to h("#{month_f.year}-#{month_f.month}"),
162 <%= link_to h("#{month_f.year}-#{month_f.month}"),
163 @gantt.params.merge(:year => month_f.year, :month => month_f.month),
163 @gantt.params.merge(:year => month_f.year, :month => month_f.month),
164 :title => "#{month_name(month_f.month)} #{month_f.year}" %>
164 :title => "#{month_name(month_f.month)} #{month_f.year}" %>
165 <% end %>
165 <% end %>
166 <%
166 <%
167 left = left + width + 1
167 left = left + width + 1
168 month_f = month_f >> 1
168 month_f = month_f >> 1
169 %>
169 %>
170 <% end %>
170 <% end %>
171
171
172 <% ###### Weeks headers ###### %>
172 <% ###### Weeks headers ###### %>
173 <% if show_weeks %>
173 <% if show_weeks %>
174 <%
174 <%
175 left = 0
175 left = 0
176 height = (show_days ? header_heigth - 1 : header_heigth - 1 + g_height)
176 height = (show_days ? header_height - 1 : header_height - 1 + g_height)
177 %>
177 %>
178 <% if @gantt.date_from.cwday == 1 %>
178 <% if @gantt.date_from.cwday == 1 %>
179 <%
179 <%
180 # @date_from is monday
180 # @date_from is monday
181 week_f = @gantt.date_from
181 week_f = @gantt.date_from
182 %>
182 %>
183 <% else %>
183 <% else %>
184 <%
184 <%
185 # find next monday after @date_from
185 # find next monday after @date_from
186 week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1)
186 week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1)
187 width = (7 - @gantt.date_from.cwday + 1) * zoom - 1
187 width = (7 - @gantt.date_from.cwday + 1) * zoom - 1
188 style = ""
188 style = ""
189 style += "left: #{left}px;"
189 style += "left: #{left}px;"
190 style += "top: 19px;"
190 style += "top: 19px;"
191 style += "width: #{width}px;"
191 style += "width: #{width}px;"
192 style += "height: #{height}px;"
192 style += "height: #{height}px;"
193 %>
193 %>
194 <%= content_tag(:div, '&nbsp;'.html_safe,
194 <%= content_tag(:div, '&nbsp;'.html_safe,
195 :style => style, :class => "gantt_hdr") %>
195 :style => style, :class => "gantt_hdr") %>
196 <% left = left + width + 1 %>
196 <% left = left + width + 1 %>
197 <% end %>
197 <% end %>
198 <% while week_f <= @gantt.date_to %>
198 <% while week_f <= @gantt.date_to %>
199 <%
199 <%
200 width = ((week_f + 6 <= @gantt.date_to) ?
200 width = ((week_f + 6 <= @gantt.date_to) ?
201 7 * zoom - 1 :
201 7 * zoom - 1 :
202 (@gantt.date_to - week_f + 1) * zoom - 1).to_i
202 (@gantt.date_to - week_f + 1) * zoom - 1).to_i
203 style = ""
203 style = ""
204 style += "left: #{left}px;"
204 style += "left: #{left}px;"
205 style += "top: 19px;"
205 style += "top: 19px;"
206 style += "width: #{width}px;"
206 style += "width: #{width}px;"
207 style += "height: #{height}px;"
207 style += "height: #{height}px;"
208 %>
208 %>
209 <%= content_tag(:div, :style => style, :class => "gantt_hdr") do %>
209 <%= content_tag(:div, :style => style, :class => "gantt_hdr") do %>
210 <%= content_tag(:small) do %>
210 <%= content_tag(:small) do %>
211 <%= week_f.cweek if width >= 16 %>
211 <%= week_f.cweek if width >= 16 %>
212 <% end %>
212 <% end %>
213 <% end %>
213 <% end %>
214 <%
214 <%
215 left = left + width + 1
215 left = left + width + 1
216 week_f = week_f + 7
216 week_f = week_f + 7
217 %>
217 %>
218 <% end %>
218 <% end %>
219 <% end %>
219 <% end %>
220
220
221 <% ###### Days headers ####### %>
221 <% ###### Days headers ####### %>
222 <% if show_days %>
222 <% if show_days %>
223 <%
223 <%
224 left = 0
224 left = 0
225 height = g_height + header_heigth - 1
225 height = g_height + header_height - 1
226 wday = @gantt.date_from.cwday
226 wday = @gantt.date_from.cwday
227 %>
227 %>
228 <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %>
228 <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %>
229 <%
229 <%
230 width = zoom - 1
230 width = zoom - 1
231 style = ""
231 style = ""
232 style += "left: #{left}px;"
232 style += "left: #{left}px;"
233 style += "top:37px;"
233 style += "top:37px;"
234 style += "width: #{width}px;"
234 style += "width: #{width}px;"
235 style += "height: #{height}px;"
235 style += "height: #{height}px;"
236 style += "font-size:0.7em;"
236 style += "font-size:0.7em;"
237 clss = "gantt_hdr"
237 clss = "gantt_hdr"
238 clss << " nwday" if @gantt.non_working_week_days.include?(wday)
238 clss << " nwday" if @gantt.non_working_week_days.include?(wday)
239 %>
239 %>
240 <%= content_tag(:div, :style => style, :class => clss) do %>
240 <%= content_tag(:div, :style => style, :class => clss) do %>
241 <%= day_letter(wday) %>
241 <%= day_letter(wday) %>
242 <% end %>
242 <% end %>
243 <%
243 <%
244 left = left + width + 1
244 left = left + width + 1
245 wday = wday + 1
245 wday = wday + 1
246 wday = 1 if wday > 7
246 wday = 1 if wday > 7
247 %>
247 %>
248 <% end %>
248 <% end %>
249 <% end %>
249 <% end %>
250
250
251 <%= @gantt.lines.html_safe %>
251 <%= @gantt.lines.html_safe %>
252
252
253 <% ###### Today red line (excluded from cache) ###### %>
253 <% ###### Today red line (excluded from cache) ###### %>
254 <% if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %>
254 <% if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %>
255 <%
255 <%
256 today_left = (((Date.today - @gantt.date_from + 1) * zoom).floor() - 1).to_i
256 today_left = (((Date.today - @gantt.date_from + 1) * zoom).floor() - 1).to_i
257 style = ""
257 style = ""
258 style += "position: absolute;"
258 style += "position: absolute;"
259 style += "height: #{g_height}px;"
259 style += "height: #{g_height}px;"
260 style += "top: #{headers_height + 1}px;"
260 style += "top: #{headers_height + 1}px;"
261 style += "left: #{today_left}px;"
261 style += "left: #{today_left}px;"
262 style += "width:10px;"
262 style += "width:10px;"
263 style += "border-left: 1px dashed red;"
263 style += "border-left: 1px dashed red;"
264 %>
264 %>
265 <%= content_tag(:div, '&nbsp;'.html_safe, :style => style, :id => 'today_line') %>
265 <%= content_tag(:div, '&nbsp;'.html_safe, :style => style, :id => 'today_line') %>
266 <% end %>
266 <% end %>
267 <%
267 <%
268 style = ""
268 style = ""
269 style += "position: absolute;"
269 style += "position: absolute;"
270 style += "height: #{g_height}px;"
270 style += "height: #{g_height}px;"
271 style += "top: #{headers_height + 1}px;"
271 style += "top: #{headers_height + 1}px;"
272 style += "left: 0px;"
272 style += "left: 0px;"
273 style += "width: #{g_width - 1}px;"
273 style += "width: #{g_width - 1}px;"
274 %>
274 %>
275 <%= content_tag(:div, '', :style => style, :id => "gantt_draw_area") %>
275 <%= content_tag(:div, '', :style => style, :id => "gantt_draw_area") %>
276 </div>
276 </div>
277 </td>
277 </td>
278 </tr>
278 </tr>
279 </table>
279 </table>
280
280
281 <table style="width:100%">
281 <table style="width:100%">
282 <tr>
282 <tr>
283 <td align="left">
283 <td align="left">
284 <%= link_to_content_update("\xc2\xab " + l(:label_previous),
284 <%= link_to_content_update("\xc2\xab " + l(:label_previous),
285 params.merge(@gantt.params_previous)) %>
285 params.merge(@gantt.params_previous)) %>
286 </td>
286 </td>
287 <td align="right">
287 <td align="right">
288 <%= link_to_content_update(l(:label_next) + " \xc2\xbb",
288 <%= link_to_content_update(l(:label_next) + " \xc2\xbb",
289 params.merge(@gantt.params_next)) %>
289 params.merge(@gantt.params_next)) %>
290 </td>
290 </td>
291 </tr>
291 </tr>
292 </table>
292 </table>
293
293
294 <% other_formats_links do |f| %>
294 <% other_formats_links do |f| %>
295 <%= f.link_to 'PDF', :url => params.merge(@gantt.params) %>
295 <%= f.link_to 'PDF', :url => params.merge(@gantt.params) %>
296 <%= f.link_to('PNG', :url => params.merge(@gantt.params)) if @gantt.respond_to?('to_image') %>
296 <%= f.link_to('PNG', :url => params.merge(@gantt.params)) if @gantt.respond_to?('to_image') %>
297 <% end %>
297 <% end %>
298 <% end # query.valid? %>
298 <% end # query.valid? %>
299
299
300 <% content_for :sidebar do %>
300 <% content_for :sidebar do %>
301 <%= render :partial => 'issues/sidebar' %>
301 <%= render :partial => 'issues/sidebar' %>
302 <% end %>
302 <% end %>
303
303
304 <% html_title(l(:label_gantt)) -%>
304 <% html_title(l(:label_gantt)) -%>
305
305
306 <% content_for :header_tags do %>
306 <% content_for :header_tags do %>
307 <%= javascript_include_tag 'raphael' %>
307 <%= javascript_include_tag 'raphael' %>
308 <%= javascript_include_tag 'gantt' %>
308 <%= javascript_include_tag 'gantt' %>
309 <% end %>
309 <% end %>
310
310
311 <%= javascript_tag do %>
311 <%= javascript_tag do %>
312 var issue_relation_type = <%= raw Redmine::Helpers::Gantt::DRAW_TYPES.to_json %>;
312 var issue_relation_type = <%= raw Redmine::Helpers::Gantt::DRAW_TYPES.to_json %>;
313 $(document).ready(drawGanttHandler);
313 $(document).ready(drawGanttHandler);
314 $(window).resize(drawGanttHandler);
314 $(window).resize(drawGanttHandler);
315 $(function() {
315 $(function() {
316 $("#draw_rels").change(drawGanttHandler);
316 $("#draw_rels").change(drawGanttHandler);
317 $("#draw_progress_line").change(drawGanttHandler);
317 $("#draw_progress_line").change(drawGanttHandler);
318 });
318 });
319 <% end %>
319 <% end %>
General Comments 0
You need to be logged in to leave comments. Login now