2 @zoom.times { zoom = zoom * 2 }
7 headers_height = header_heigth
13 headers_height = 2*header_heigth
16 headers_height = 3*header_heigth
20 g_width = (@date_to - @date_from + 1)*zoom
21 g_height = [(20 * @events.length + 6)+150, 206].max
22 t_height = g_height + headers_height
25 <div class="contextual">
28 <h2><%= l(:label_gantt) %></h2>
30 <% form_tag(params.merge(:month => nil, :year => nil, :months => nil)) do %>
34 <input type="text" name="months" size="2" value="<%= @months %>" />
35 <%= l(:label_months_from) %>
36 <%= select_month(@month_from, :prefix => "month", :discard_type => true) %>
37 <%= select_year(@year_from, :prefix => "year", :discard_type => true) %>
38 <%= hidden_field_tag 'zoom', @zoom %>
39 <%= submit_tag l(:button_submit), :class => "button-small" %>
44 link_to image_tag('zoom_in.png'), {:zoom => (@zoom+1), :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects]}
46 image_tag 'zoom_in_g.png'
49 link_to image_tag('zoom_out.png'),{:zoom => (@zoom-1), :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects]}
51 image_tag 'zoom_out_g.png'
58 <% cache(:year => @year_from, :month => @month_from, :months => @months, :zoom => @zoom, :tracker_ids => @selected_tracker_ids, :subprojects => params[:with_subprojects], :lang => current_language) do %>
60 <table width="100%" style="border:0; border-collapse: collapse;">
62 <td style="width:<%= subject_width %>px;">
64 <div style="position:relative;height:<%= t_height + 24 %>px;width:<%= subject_width + 1 %>px;">
65 <div style="right:-2px;width:<%= subject_width %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr"></div>
66 <div style="right:-2px;width:<%= subject_width %>px;height:<%= t_height %>px;border-left: 1px solid #c0c0c0;overflow:hidden;" class="gantt_hdr"></div>
71 top = headers_height + 8
72 @events.each do |i| %>
73 <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"><small>
74 <% if i.is_a? Issue %>
75 <%= link_to_issue i %><%= " (#{i.project.name})" unless @project && @project == i.project %>:
78 <%= link_to_version i, :class => "icon icon-package" %>
87 <div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;">
88 <div style="width:<%= g_width-1 %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr"> </div>
95 height = (show_weeks ? header_heigth : header_heigth + g_height)
97 width = ((month_f >> 1) - month_f) * zoom - 1
99 <div style="left:<%= left %>px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">
100 <%= link_to "#{month_f.year}-#{month_f.month}", { :year => month_f.year, :month => month_f.month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] }, :title => "#{month_name(month_f.month)} #{month_f.year}"%>
103 left = left + width + 1
104 month_f = month_f >> 1
113 height = (show_days ? header_heigth-1 : header_heigth-1 + g_height)
114 if @date_from.cwday == 1
115 # @date_from is monday
118 # find next monday after @date_from
119 week_f = @date_from + (7 - @date_from.cwday + 1)
120 width = (7 - @date_from.cwday + 1) * zoom-1
122 <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr"> </div>
124 left = left + width+1
127 while week_f <= @date_to
128 width = (week_f + 6 <= @date_to) ? 7 * zoom -1 : (@date_to - week_f + 1) * zoom-1
130 <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">
131 <small><%= week_f.cweek if width >= 16 %></small>
134 left = left + width+1
145 height = g_height + header_heigth - 1
146 wday = @date_from.cwday
147 (@date_to - @date_from + 1).to_i.times do
150 <div style="left:<%= left %>px;top:37px;width:<%= width %>px;height:<%= height %>px;font-size:0.7em;<%= "background:#f1f1f1;" if wday > 5 %>" class="gantt_hdr">
151 <%= day_name(wday).first %>
154 left = left + width+1
164 top = headers_height + 10
167 i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from )
168 i_end_date = (i.due_date <= @date_to ? i.due_date : @date_to )
170 i_done_date = i.start_date + ((i.due_date - i.start_date+1)*i.done_ratio/100).floor
171 i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date )
172 i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date )
174 i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today
176 i_left = ((i_start_date - @date_from)*zoom).floor
177 i_width = ((i_end_date - i_start_date + 1)*zoom).floor - 2 # total width of the issue (- 2 for left and right borders)
178 d_width = ((i_done_date - i_start_date)*zoom).floor - 2 # done width
179 l_width = i_late_date ? ((i_late_date - i_start_date+1)*zoom).floor - 2 : 0 # delay width
181 <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;" class="task task_todo"> </div>
183 <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= l_width %>px;" class="task task_late"> </div>
186 <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= d_width %>px;" class="task task_done"> </div>
188 <div style="top:<%= top %>px;left:<%= i_left + i_width + 5 %>px;background:#fff;" class="task">
190 <%= (i.done_ratio).to_i %>%
192 <% # === tooltip === %>
193 <div class="tooltip" style="position: absolute;top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;height:12px;">
195 <%= render_issue_tooltip i %>
198 i_left = ((i.start_date - @date_from)*zoom).floor
200 <div style="top:<%= top %>px;left:<%= i_left %>px;width:15px;" class="task milestone"> </div>
201 <div style="top:<%= top %>px;left:<%= i_left + 12 %>px;background:#fff;" class="task">
202 <strong><%= i.name %></strong>
213 # Today red line (excluded from cache)
215 if Date.today >= @date_from and Date.today <= @date_to %>
216 <div style="position: absolute;height:<%= g_height %>px;top:<%= headers_height + 1 %>px;left:<%= ((Date.today-@date_from+1)*zoom).floor()-1 %>px;width:10px;border-left: 1px dashed red;"> </div>
226 <td align="left"><%= link_to ('« ' + l(:label_previous)), :year => (@date_from << @months).year, :month => (@date_from << @months).month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] %></td>
227 <td align="right"><%= link_to (l(:label_next) + ' »'), :year => (@date_from >> @months).year, :month => (@date_from >> @months).month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] %></td>
231 <div class="contextual"><%= l(:label_export_to) %>
232 <%= link_to 'PDF', {:zoom => @zoom, :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects], :format => 'pdf'}, :class => 'icon icon-pdf' %>
233 <%= link_to 'PNG', {:zoom => @zoom, :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects], :format => 'png'}, :class => 'icon icon-image' if respond_to?('gantt_image') %>
236 <% content_for :sidebar do %>
237 <h3><%= l(:label_gantt) %></h3>
238 <% form_tag(params.merge(:tracker_ids => nil, :with_subprojects => nil)) do %>
239 <% @trackers.each do |tracker| %>
240 <label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> <%= tracker.name %></label><br />
242 <% if @project.active_children.any? %>
243 <br /><label><%= check_box_tag "with_subprojects", 1, params[:with_subprojects] %> <%=l(:label_subproject_plural)%></label>
245 <p><%= submit_tag l(:button_apply), :class => 'button-small' %></p>