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