chris@22
|
1 <% @gantt.view = self %>
|
Chris@0
|
2 <h2><%= l(:label_gantt) %></h2>
|
Chris@0
|
3
|
chris@22
|
4 <% form_tag(gantt_path(:month => params[:month], :year => params[:year], :months => params[:months]), :method => :put, :id => 'query_form') do %>
|
chris@22
|
5 <%= hidden_field_tag('project_id', @project.to_param) if @project%>
|
Chris@0
|
6 <fieldset id="filters" class="collapsible">
|
Chris@0
|
7 <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend>
|
Chris@0
|
8 <div>
|
Chris@0
|
9 <%= render :partial => 'queries/filters', :locals => {:query => @query} %>
|
Chris@0
|
10 </div>
|
Chris@0
|
11 </fieldset>
|
Chris@0
|
12
|
chris@37
|
13 <p class="contextual">
|
Chris@0
|
14 <%= gantt_zoom_link(@gantt, :in) %>
|
Chris@0
|
15 <%= gantt_zoom_link(@gantt, :out) %>
|
Chris@0
|
16 </p>
|
Chris@0
|
17
|
Chris@0
|
18 <p class="buttons">
|
Chris@0
|
19 <%= text_field_tag 'months', @gantt.months, :size => 2 %>
|
Chris@0
|
20 <%= l(:label_months_from) %>
|
Chris@0
|
21 <%= select_month(@gantt.month_from, :prefix => "month", :discard_type => true) %>
|
Chris@0
|
22 <%= select_year(@gantt.year_from, :prefix => "year", :discard_type => true) %>
|
Chris@0
|
23 <%= hidden_field_tag 'zoom', @gantt.zoom %>
|
Chris@0
|
24
|
Chris@0
|
25 <%= link_to_remote l(:button_apply),
|
Chris@0
|
26 { :url => { :set_filter => (@query.new_record? ? 1 : nil) },
|
Chris@0
|
27 :update => "content",
|
Chris@0
|
28 :with => "Form.serialize('query_form')"
|
Chris@0
|
29 }, :class => 'icon icon-checked' %>
|
Chris@0
|
30
|
Chris@0
|
31 <%= link_to_remote l(:button_clear),
|
chris@37
|
32 { :url => { :project_id => @project, :set_filter => (@query.new_record? ? 1 : nil) },
|
chris@37
|
33 :method => :put,
|
Chris@0
|
34 :update => "content",
|
Chris@0
|
35 }, :class => 'icon icon-reload' if @query.new_record? %>
|
Chris@0
|
36 </p>
|
Chris@0
|
37 <% end %>
|
Chris@0
|
38
|
Chris@0
|
39 <%= error_messages_for 'query' %>
|
Chris@0
|
40 <% if @query.valid? %>
|
Chris@0
|
41 <% zoom = 1
|
Chris@0
|
42 @gantt.zoom.times { zoom = zoom * 2 }
|
Chris@0
|
43
|
Chris@0
|
44 subject_width = 330
|
Chris@0
|
45 header_heigth = 18
|
Chris@0
|
46
|
Chris@0
|
47 headers_height = header_heigth
|
Chris@0
|
48 show_weeks = false
|
Chris@0
|
49 show_days = false
|
Chris@0
|
50
|
Chris@0
|
51 if @gantt.zoom >1
|
Chris@0
|
52 show_weeks = true
|
Chris@0
|
53 headers_height = 2*header_heigth
|
Chris@0
|
54 if @gantt.zoom > 2
|
Chris@0
|
55 show_days = true
|
Chris@0
|
56 headers_height = 3*header_heigth
|
Chris@0
|
57 end
|
Chris@0
|
58 end
|
Chris@0
|
59
|
chris@22
|
60 # Width of the entire chart
|
Chris@0
|
61 g_width = (@gantt.date_to - @gantt.date_from + 1)*zoom
|
chris@22
|
62 # Collect the number of issues on Versions
|
chris@22
|
63 g_height = [(20 * (@gantt.number_of_rows + 6))+150, 206].max
|
Chris@0
|
64 t_height = g_height + headers_height
|
Chris@0
|
65 %>
|
Chris@0
|
66 <table width="100%" style="border:0; border-collapse: collapse;">
|
Chris@0
|
67 <tr>
|
Chris@0
|
68 <td style="width:<%= subject_width %>px; padding:0px;">
|
Chris@0
|
69
|
Chris@0
|
70 <div style="position:relative;height:<%= t_height + 24 %>px;width:<%= subject_width + 1 %>px;">
|
Chris@0
|
71 <div style="right:-2px;width:<%= subject_width %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr"></div>
|
Chris@0
|
72 <div style="right:-2px;width:<%= subject_width %>px;height:<%= t_height %>px;border-left: 1px solid #c0c0c0;overflow:hidden;" class="gantt_hdr"></div>
|
chris@22
|
73 <% top = headers_height + 8 %>
|
chris@22
|
74
|
chris@22
|
75 <%= @gantt.subjects(:headers_height => headers_height, :top => top, :g_width => g_width) %>
|
chris@22
|
76
|
Chris@0
|
77 </div>
|
Chris@0
|
78 </td>
|
Chris@0
|
79 <td>
|
Chris@0
|
80
|
Chris@0
|
81 <div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;">
|
Chris@0
|
82 <div style="width:<%= g_width-1 %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr"> </div>
|
Chris@0
|
83 <%
|
Chris@0
|
84 #
|
Chris@0
|
85 # Months headers
|
Chris@0
|
86 #
|
Chris@0
|
87 month_f = @gantt.date_from
|
Chris@0
|
88 left = 0
|
Chris@0
|
89 height = (show_weeks ? header_heigth : header_heigth + g_height)
|
Chris@0
|
90 @gantt.months.times do
|
Chris@0
|
91 width = ((month_f >> 1) - month_f) * zoom - 1
|
Chris@0
|
92 %>
|
Chris@0
|
93 <div style="left:<%= left %>px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">
|
Chris@0
|
94 <%= link_to "#{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}"%>
|
Chris@0
|
95 </div>
|
Chris@0
|
96 <%
|
Chris@0
|
97 left = left + width + 1
|
Chris@0
|
98 month_f = month_f >> 1
|
Chris@0
|
99 end %>
|
Chris@0
|
100
|
Chris@0
|
101 <%
|
Chris@0
|
102 #
|
Chris@0
|
103 # Weeks headers
|
Chris@0
|
104 #
|
Chris@0
|
105 if show_weeks
|
Chris@0
|
106 left = 0
|
Chris@0
|
107 height = (show_days ? header_heigth-1 : header_heigth-1 + g_height)
|
Chris@0
|
108 if @gantt.date_from.cwday == 1
|
Chris@0
|
109 # @date_from is monday
|
Chris@0
|
110 week_f = @gantt.date_from
|
Chris@0
|
111 else
|
Chris@0
|
112 # find next monday after @date_from
|
Chris@0
|
113 week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1)
|
Chris@0
|
114 width = (7 - @gantt.date_from.cwday + 1) * zoom-1
|
Chris@0
|
115 %>
|
Chris@0
|
116 <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr"> </div>
|
Chris@0
|
117 <%
|
Chris@0
|
118 left = left + width+1
|
Chris@0
|
119 end %>
|
Chris@0
|
120 <%
|
Chris@0
|
121 while week_f <= @gantt.date_to
|
Chris@0
|
122 width = (week_f + 6 <= @gantt.date_to) ? 7 * zoom -1 : (@gantt.date_to - week_f + 1) * zoom-1
|
Chris@0
|
123 %>
|
Chris@0
|
124 <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">
|
Chris@0
|
125 <small><%= week_f.cweek if width >= 16 %></small>
|
Chris@0
|
126 </div>
|
Chris@0
|
127 <%
|
Chris@0
|
128 left = left + width+1
|
Chris@0
|
129 week_f = week_f+7
|
Chris@0
|
130 end
|
Chris@0
|
131 end %>
|
Chris@0
|
132
|
Chris@0
|
133 <%
|
Chris@0
|
134 #
|
Chris@0
|
135 # Days headers
|
Chris@0
|
136 #
|
Chris@0
|
137 if show_days
|
Chris@0
|
138 left = 0
|
Chris@0
|
139 height = g_height + header_heigth - 1
|
Chris@0
|
140 wday = @gantt.date_from.cwday
|
Chris@0
|
141 (@gantt.date_to - @gantt.date_from + 1).to_i.times do
|
Chris@0
|
142 width = zoom - 1
|
Chris@0
|
143 %>
|
Chris@0
|
144 <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">
|
Chris@0
|
145 <%= day_name(wday).first %>
|
Chris@0
|
146 </div>
|
Chris@0
|
147 <%
|
Chris@0
|
148 left = left + width+1
|
Chris@0
|
149 wday = wday + 1
|
Chris@0
|
150 wday = 1 if wday > 7
|
Chris@0
|
151 end
|
Chris@0
|
152 end %>
|
Chris@0
|
153
|
chris@22
|
154 <% top = headers_height + 10 %>
|
chris@22
|
155
|
chris@22
|
156 <%= @gantt.lines(:top => top, :zoom => zoom, :g_width => g_width ) %>
|
Chris@0
|
157
|
Chris@0
|
158 <%
|
Chris@0
|
159 #
|
Chris@0
|
160 # Today red line (excluded from cache)
|
Chris@0
|
161 #
|
Chris@0
|
162 if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %>
|
Chris@0
|
163 <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>
|
Chris@0
|
164 <% end %>
|
Chris@0
|
165
|
Chris@0
|
166 </div>
|
Chris@0
|
167 </td>
|
Chris@0
|
168 </tr>
|
Chris@0
|
169 </table>
|
Chris@0
|
170
|
Chris@0
|
171 <table width="100%">
|
Chris@0
|
172 <tr>
|
chris@22
|
173 <td align="left"><%= link_to_remote ('« ' + l(:label_previous)), {:url => @gantt.params_previous, :method => :get, :update => 'content', :complete => 'window.scrollTo(0,0)'}, {:href => url_for(@gantt.params_previous)} %></td>
|
chris@22
|
174 <td align="right"><%= link_to_remote (l(:label_next) + ' »'), {:url => @gantt.params_next, :method => :get, :update => 'content', :complete => 'window.scrollTo(0,0)'}, {:href => url_for(@gantt.params_next)} %></td>
|
Chris@0
|
175 </tr>
|
Chris@0
|
176 </table>
|
Chris@0
|
177
|
Chris@0
|
178 <% other_formats_links do |f| %>
|
Chris@0
|
179 <%= f.link_to 'PDF', :url => @gantt.params %>
|
Chris@0
|
180 <%= f.link_to('PNG', :url => @gantt.params) if @gantt.respond_to?('to_image') %>
|
Chris@0
|
181 <% end %>
|
Chris@0
|
182 <% end # query.valid? %>
|
Chris@0
|
183
|
Chris@0
|
184 <% content_for :sidebar do %>
|
Chris@0
|
185 <%= render :partial => 'issues/sidebar' %>
|
Chris@0
|
186 <% end %>
|
Chris@0
|
187
|
Chris@0
|
188 <% html_title(l(:label_gantt)) -%>
|