comparison app/views/gantts/show.html.erb @ 1298:4f746d8966dd redmine_2.3_integration

Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author Chris Cannam
date Fri, 14 Jun 2013 09:28:30 +0100
parents 622f24f53b42
children
comparison
equal deleted inserted replaced
1297:0a574315af3e 1298:4f746d8966dd
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">
16 <legend onclick="toggleFieldset(this);"><%= l(:label_options) %></legend>
17 <div style="display: none;">
18 <table>
19 <tr>
20 <td>
21 <fieldset>
22 <legend><%= l(:label_related_issues) %></legend>
23 <label>
24 <%= check_box_tag "draw_rels", params["draw_rels"], params[:set_filter].blank? || params[:draw_rels] %>
25 <% rels = [IssueRelation::TYPE_BLOCKS, IssueRelation::TYPE_PRECEDES] %>
26 <% rels.each do |rel| %>
27 <% color = Redmine::Helpers::Gantt::DRAW_TYPES[rel][:color] %>
28 <%= content_tag(:span, '&nbsp;&nbsp;&nbsp;'.html_safe,
29 :style => "background-color: #{color}") %>
30 <%= l(IssueRelation::TYPES[rel][:name]) %>
31 <% end %>
32 </label>
33 </fieldset>
34 </td>
35 <td>
36 <fieldset>
37 <legend><%= l(:label_gantt_progress_line) %></legend>
38 <label>
39 <%= check_box_tag "draw_progress_line", params[:draw_progress_line], params[:draw_progress_line] %>
40 <%= l(:label_display) %>
41 </label>
42 </fieldset>
43 </td>
44 </tr>
45 </table>
46 </div>
47 </fieldset>
15 48
16 <p class="contextual"> 49 <p class="contextual">
17 <%= gantt_zoom_link(@gantt, :in) %> 50 <%= gantt_zoom_link(@gantt, :in) %>
18 <%= gantt_zoom_link(@gantt, :out) %> 51 <%= gantt_zoom_link(@gantt, :out) %>
19 </p> 52 </p>
37 <% 70 <%
38 zoom = 1 71 zoom = 1
39 @gantt.zoom.times { zoom = zoom * 2 } 72 @gantt.zoom.times { zoom = zoom * 2 }
40 73
41 subject_width = 330 74 subject_width = 330
42 header_heigth = 18 75 header_height = 18
43 76
44 headers_height = header_heigth 77 headers_height = header_height
45 show_weeks = false 78 show_weeks = false
46 show_days = false 79 show_days = false
47 80
48 if @gantt.zoom > 1 81 if @gantt.zoom > 1
49 show_weeks = true 82 show_weeks = true
50 headers_height = 2 * header_heigth 83 headers_height = 2 * header_height
51 if @gantt.zoom > 2 84 if @gantt.zoom > 2
52 show_days = true 85 show_days = true
53 headers_height = 3 * header_heigth 86 headers_height = 3 * header_height
54 end 87 end
55 end 88 end
56 89
57 # Width of the entire chart 90 # Width of the entire chart
58 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
100 <% end %> 133 <% end %>
101 <% end %> 134 <% end %>
102 </td> 135 </td>
103 136
104 <td> 137 <td>
105 <div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;"> 138 <div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;" id="gantt_area">
106 <% 139 <%
107 style = "" 140 style = ""
108 style += "width: #{g_width - 1}px;" 141 style += "width: #{g_width - 1}px;"
109 style += "height: #{headers_height}px;" 142 style += "height: #{headers_height}px;"
110 style += 'background: #eee;' 143 style += 'background: #eee;'
113 146
114 <% ###### Months headers ###### %> 147 <% ###### Months headers ###### %>
115 <% 148 <%
116 month_f = @gantt.date_from 149 month_f = @gantt.date_from
117 left = 0 150 left = 0
118 height = (show_weeks ? header_heigth : header_heigth + g_height) 151 height = (show_weeks ? header_height : header_height + g_height)
119 %> 152 %>
120 <% @gantt.months.times do %> 153 <% @gantt.months.times do %>
121 <% 154 <%
122 width = (((month_f >> 1) - month_f) * zoom - 1).to_i 155 width = (((month_f >> 1) - month_f) * zoom - 1).to_i
123 style = "" 156 style = ""
138 171
139 <% ###### Weeks headers ###### %> 172 <% ###### Weeks headers ###### %>
140 <% if show_weeks %> 173 <% if show_weeks %>
141 <% 174 <%
142 left = 0 175 left = 0
143 height = (show_days ? header_heigth - 1 : header_heigth - 1 + g_height) 176 height = (show_days ? header_height - 1 : header_height - 1 + g_height)
144 %> 177 %>
145 <% if @gantt.date_from.cwday == 1 %> 178 <% if @gantt.date_from.cwday == 1 %>
146 <% 179 <%
147 # @date_from is monday 180 # @date_from is monday
148 week_f = @gantt.date_from 181 week_f = @gantt.date_from
187 220
188 <% ###### Days headers ####### %> 221 <% ###### Days headers ####### %>
189 <% if show_days %> 222 <% if show_days %>
190 <% 223 <%
191 left = 0 224 left = 0
192 height = g_height + header_heigth - 1 225 height = g_height + header_height - 1
193 wday = @gantt.date_from.cwday 226 wday = @gantt.date_from.cwday
194 %> 227 %>
195 <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %> 228 <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %>
196 <% 229 <%
197 width = zoom - 1 230 width = zoom - 1
227 style += "top: #{headers_height + 1}px;" 260 style += "top: #{headers_height + 1}px;"
228 style += "left: #{today_left}px;" 261 style += "left: #{today_left}px;"
229 style += "width:10px;" 262 style += "width:10px;"
230 style += "border-left: 1px dashed red;" 263 style += "border-left: 1px dashed red;"
231 %> 264 %>
232 <%= content_tag(:div, '&nbsp;'.html_safe, :style => style) %> 265 <%= content_tag(:div, '&nbsp;'.html_safe, :style => style, :id => 'today_line') %>
233 <% end %> 266 <% end %>
234 267 <%
268 style = ""
269 style += "position: absolute;"
270 style += "height: #{g_height}px;"
271 style += "top: #{headers_height + 1}px;"
272 style += "left: 0px;"
273 style += "width: #{g_width - 1}px;"
274 %>
275 <%= content_tag(:div, '', :style => style, :id => "gantt_draw_area") %>
235 </div> 276 </div>
236 </td> 277 </td>
237 </tr> 278 </tr>
238 </table> 279 </table>
239 280
259 <% content_for :sidebar do %> 300 <% content_for :sidebar do %>
260 <%= render :partial => 'issues/sidebar' %> 301 <%= render :partial => 'issues/sidebar' %>
261 <% end %> 302 <% end %>
262 303
263 <% html_title(l(:label_gantt)) -%> 304 <% html_title(l(:label_gantt)) -%>
305
306 <% content_for :header_tags do %>
307 <%= javascript_include_tag 'raphael' %>
308 <%= javascript_include_tag 'gantt' %>
309 <% end %>
310
311 <%= javascript_tag do %>
312 var issue_relation_type = <%= raw Redmine::Helpers::Gantt::DRAW_TYPES.to_json %>;
313 $(document).ready(drawGanttHandler);
314 $(window).resize(drawGanttHandler);
315 $(function() {
316 $("#draw_rels").change(drawGanttHandler);
317 $("#draw_progress_line").change(drawGanttHandler);
318 });
319 <% end %>