##// END OF EJS Templates
Use GET instead of POST on roadmap (#718), gantt and calendar forms....
Jean-Philippe Lang -
r1373:b2abe48592b3
parent child
Show More
@@ -1,41 +1,41
1 1 <h2><%= "#{month_name(@month)} #{@year}" %></h2>
2 2
3 3 <table width="100%">
4 4 <tr><td align="left">
5 5 <%= link_to_remote ('&#171; ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")),
6 6 {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] }},
7 7 {:href => url_for(:action => 'calendar', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects])}
8 8 %>
9 9 </td><td align="right">
10 10 <%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' &#187;'),
11 11 {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] }},
12 12 {:href => url_for(:action => 'calendar', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects])}
13 13 %>
14 14 </td></tr>
15 15 </table>
16 16
17 17 <%= render :partial => 'common/calendar', :locals => {:calendar => @calendar} %>
18 18
19 19 <%= image_tag 'arrow_from.png' %>&nbsp;&nbsp;<%= l(:text_tip_task_begin_day) %><br />
20 20 <%= image_tag 'arrow_to.png' %>&nbsp;&nbsp;<%= l(:text_tip_task_end_day) %><br />
21 21 <%= image_tag 'arrow_bw.png' %>&nbsp;&nbsp;<%= l(:text_tip_task_begin_end_day) %><br />
22 22
23 23 <% content_for :sidebar do %>
24 24 <h3><%= l(:label_calendar) %></h3>
25 25
26 <% form_tag() do %>
26 <% form_tag({}, :method => :get) do %>
27 27 <p><%= select_month(@month, :prefix => "month", :discard_type => true) %>
28 28 <%= select_year(@year, :prefix => "year", :discard_type => true) %></p>
29 29
30 30 <% @trackers.each do |tracker| %>
31 31 <label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> <%= tracker.name %></label><br />
32 32 <% end %>
33 33 <% if @project.active_children.any? %>
34 34 <br /><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label>
35 35 <%= hidden_field_tag 'with_subprojects', 0 %>
36 36 <% end %>
37 37 <p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
38 38 <% end %>
39 39 <% end %>
40 40
41 41 <% html_title(l(:label_calendar)) -%>
@@ -1,250 +1,250
1 1 <% zoom = 1
2 2 @zoom.times { zoom = zoom * 2 }
3 3
4 4 subject_width = 330
5 5 header_heigth = 18
6 6
7 7 headers_height = header_heigth
8 8 show_weeks = false
9 9 show_days = false
10 10
11 11 if @zoom >1
12 12 show_weeks = true
13 13 headers_height = 2*header_heigth
14 14 if @zoom > 2
15 15 show_days = true
16 16 headers_height = 3*header_heigth
17 17 end
18 18 end
19 19
20 20 g_width = (@date_to - @date_from + 1)*zoom
21 21 g_height = [(20 * @events.length + 6)+150, 206].max
22 22 t_height = g_height + headers_height
23 23 %>
24 24
25 25 <div class="contextual">
26 26 </div>
27 27
28 28 <h2><%= l(:label_gantt) %></h2>
29 29
30 30 <% form_tag(params.merge(:month => nil, :year => nil, :months => nil)) do %>
31 31 <table width="100%">
32 32 <tr>
33 33 <td align="left">
34 34 <input type="text" name="months" size="2" value="<%= @months %>" />
35 35 <%= l(:label_months_from) %>
36 36 <%= select_month(@month_from, :prefix => "month", :discard_type => true) %>
37 37 <%= select_year(@year_from, :prefix => "year", :discard_type => true) %>
38 38 <%= hidden_field_tag 'zoom', @zoom %>
39 39 <%= submit_tag l(:button_submit), :class => "button-small" %>
40 40 </td>
41 41
42 42 <td align="right">
43 43 <%= if @zoom < 4
44 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]}
45 45 else
46 46 image_tag 'zoom_in_g.png'
47 47 end %>
48 48 <%= if @zoom > 1
49 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]}
50 50 else
51 51 image_tag 'zoom_out_g.png'
52 52 end %>
53 53 </td>
54 54 </tr>
55 55 </table>
56 56 <% end %>
57 57
58 58 <table width="100%" style="border:0; border-collapse: collapse;">
59 59 <tr>
60 60 <td style="width:<%= subject_width %>px;">
61 61
62 62 <div style="position:relative;height:<%= t_height + 24 %>px;width:<%= subject_width + 1 %>px;">
63 63 <div style="right:-2px;width:<%= subject_width %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr"></div>
64 64 <div style="right:-2px;width:<%= subject_width %>px;height:<%= t_height %>px;border-left: 1px solid #c0c0c0;overflow:hidden;" class="gantt_hdr"></div>
65 65 <%
66 66 #
67 67 # Tasks subjects
68 68 #
69 69 top = headers_height + 8
70 70 @events.each do |i| %>
71 71 <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"><small>
72 72 <% if i.is_a? Issue %>
73 73 <%= h("#{i.project} -") unless @project && @project == i.project %>
74 74 <%= link_to_issue i %>: <%=h i.subject %>
75 75 <% else %>
76 76 <span class="icon icon-package">
77 77 <%= h("#{i.project} -") unless @project && @project == i.project %>
78 78 <%= link_to_version i %>
79 79 </span>
80 80 <% end %>
81 81 </small></div>
82 82 <% top = top + 20
83 83 end %>
84 84 </div>
85 85 </td>
86 86 <td>
87 87
88 88 <div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;">
89 89 <div style="width:<%= g_width-1 %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr">&nbsp;</div>
90 90 <%
91 91 #
92 92 # Months headers
93 93 #
94 94 month_f = @date_from
95 95 left = 0
96 96 height = (show_weeks ? header_heigth : header_heigth + g_height)
97 97 @months.times do
98 98 width = ((month_f >> 1) - month_f) * zoom - 1
99 99 %>
100 100 <div style="left:<%= left %>px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">
101 101 <%= 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}"%>
102 102 </div>
103 103 <%
104 104 left = left + width + 1
105 105 month_f = month_f >> 1
106 106 end %>
107 107
108 108 <%
109 109 #
110 110 # Weeks headers
111 111 #
112 112 if show_weeks
113 113 left = 0
114 114 height = (show_days ? header_heigth-1 : header_heigth-1 + g_height)
115 115 if @date_from.cwday == 1
116 116 # @date_from is monday
117 117 week_f = @date_from
118 118 else
119 119 # find next monday after @date_from
120 120 week_f = @date_from + (7 - @date_from.cwday + 1)
121 121 width = (7 - @date_from.cwday + 1) * zoom-1
122 122 %>
123 123 <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">&nbsp;</div>
124 124 <%
125 125 left = left + width+1
126 126 end %>
127 127 <%
128 128 while week_f <= @date_to
129 129 width = (week_f + 6 <= @date_to) ? 7 * zoom -1 : (@date_to - week_f + 1) * zoom-1
130 130 %>
131 131 <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">
132 132 <small><%= week_f.cweek if width >= 16 %></small>
133 133 </div>
134 134 <%
135 135 left = left + width+1
136 136 week_f = week_f+7
137 137 end
138 138 end %>
139 139
140 140 <%
141 141 #
142 142 # Days headers
143 143 #
144 144 if show_days
145 145 left = 0
146 146 height = g_height + header_heigth - 1
147 147 wday = @date_from.cwday
148 148 (@date_to - @date_from + 1).to_i.times do
149 149 width = zoom - 1
150 150 %>
151 151 <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">
152 152 <%= day_name(wday).first %>
153 153 </div>
154 154 <%
155 155 left = left + width+1
156 156 wday = wday + 1
157 157 wday = 1 if wday > 7
158 158 end
159 159 end %>
160 160
161 161 <%
162 162 #
163 163 # Tasks
164 164 #
165 165 top = headers_height + 10
166 166 @events.each do |i|
167 167 if i.is_a? Issue
168 168 i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from )
169 169 i_end_date = (i.due_date <= @date_to ? i.due_date : @date_to )
170 170
171 171 i_done_date = i.start_date + ((i.due_date - i.start_date+1)*i.done_ratio/100).floor
172 172 i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date )
173 173 i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date )
174 174
175 175 i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today
176 176
177 177 i_left = ((i_start_date - @date_from)*zoom).floor
178 178 i_width = ((i_end_date - i_start_date + 1)*zoom).floor - 2 # total width of the issue (- 2 for left and right borders)
179 179 d_width = ((i_done_date - i_start_date)*zoom).floor - 2 # done width
180 180 l_width = i_late_date ? ((i_late_date - i_start_date+1)*zoom).floor - 2 : 0 # delay width
181 181 %>
182 182 <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;" class="task task_todo">&nbsp;</div>
183 183 <% if l_width > 0 %>
184 184 <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= l_width %>px;" class="task task_late">&nbsp;</div>
185 185 <% end %>
186 186 <% if d_width > 0 %>
187 187 <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= d_width %>px;" class="task task_done">&nbsp;</div>
188 188 <% end %>
189 189 <div style="top:<%= top %>px;left:<%= i_left + i_width + 5 %>px;background:#fff;" class="task">
190 190 <%= i.status.name %>
191 191 <%= (i.done_ratio).to_i %>%
192 192 </div>
193 193 <% # === tooltip === %>
194 194 <div class="tooltip" style="position: absolute;top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;height:12px;">
195 195 <span class="tip">
196 196 <%= render_issue_tooltip i %>
197 197 </span></div>
198 198 <% else
199 199 i_left = ((i.start_date - @date_from)*zoom).floor
200 200 %>
201 201 <div style="top:<%= top %>px;left:<%= i_left %>px;width:15px;" class="task milestone">&nbsp;</div>
202 202 <div style="top:<%= top %>px;left:<%= i_left + 12 %>px;background:#fff;" class="task">
203 203 <%= h("#{i.project} -") unless @project && @project == i.project %>
204 204 <strong><%=h i %></strong>
205 205 </div>
206 206 <% end %>
207 207 <% top = top + 20
208 208 end %>
209 209
210 210 <%
211 211 #
212 212 # Today red line (excluded from cache)
213 213 #
214 214 if Date.today >= @date_from and Date.today <= @date_to %>
215 215 <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;">&nbsp;</div>
216 216 <% end %>
217 217
218 218 </div>
219 219 </td>
220 220 </tr>
221 221 </table>
222 222
223 223 <table width="100%">
224 224 <tr>
225 225 <td align="left"><%= link_to ('&#171; ' + 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>
226 226 <td align="right"><%= link_to (l(:label_next) + ' &#187;'), :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 227 </tr>
228 228 </table>
229 229
230 230 <p class="other-formats">
231 231 <%= l(:label_export_to) %>
232 232 <span><%= 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 => 'pdf' %></span>
233 233 <%= content_tag('span', 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 => 'image')) if respond_to?('gantt_image') %>
234 234 </p>
235 235
236 236 <% content_for :sidebar do %>
237 237 <h3><%= l(:label_gantt) %></h3>
238 <% form_tag(params.merge(:tracker_ids => nil, :with_subprojects => nil)) do %>
238 <% form_tag(params.merge(:tracker_ids => nil, :with_subprojects => nil), :method => :get) do %>
239 239 <% @trackers.each do |tracker| %>
240 240 <label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> <%= tracker.name %></label><br />
241 241 <% end %>
242 242 <% if @project.active_children.any? %>
243 243 <br /><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label>
244 244 <%= hidden_field_tag 'with_subprojects', 0 %>
245 245 <% end %>
246 <p><%= submit_tag l(:button_apply), :class => 'button-small' %></p>
246 <p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
247 247 <% end %>
248 248 <% end %>
249 249
250 250 <% html_title(l(:label_gantt)) -%>
@@ -1,50 +1,50
1 1 <h2><%=l(:label_roadmap)%></h2>
2 2
3 3 <% if @versions.empty? %>
4 4 <p class="nodata"><%= l(:label_no_data) %></p>
5 5 <% else %>
6 6 <div id="roadmap">
7 7 <% @versions.each do |version| %>
8 8 <%= tag 'a', :name => version.name %>
9 9 <h3 class="icon22 icon22-package"><%= link_to h(version.name), :controller => 'versions', :action => 'show', :id => version %></h3>
10 10 <%= render :partial => 'versions/overview', :locals => {:version => version} %>
11 11 <%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %>
12 12
13 13 <% issues = version.fixed_issues.find(:all,
14 14 :include => [:status, :tracker],
15 15 :conditions => ["tracker_id in (#{@selected_tracker_ids.join(',')})"],
16 16 :order => "#{Tracker.table_name}.position, #{Issue.table_name}.id") unless @selected_tracker_ids.empty?
17 17 issues ||= []
18 18 %>
19 19 <% if issues.size > 0 %>
20 20 <fieldset class="related-issues"><legend><%= l(:label_related_issues) %></legend>
21 21 <ul>
22 22 <%- issues.each do |issue| -%>
23 23 <li class="issue <%= 'closed' if issue.closed? %>"><%= link_to_issue(issue) %>: <%=h issue.subject %></li>
24 24 <%- end -%>
25 25 </ul>
26 26 </fieldset>
27 27 <% end %>
28 28 <% end %>
29 29 </div>
30 30 <% end %>
31 31
32 32 <% content_for :sidebar do %>
33 <% form_tag do %>
33 <% form_tag({}, :method => :get) do %>
34 34 <h3><%= l(:label_roadmap) %></h3>
35 35 <% @trackers.each do |tracker| %>
36 36 <label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s), :id => nil %>
37 37 <%= tracker.name %></label><br />
38 38 <% end %>
39 39 <br />
40 40 <label for="completed"><%= check_box_tag "completed", 1, params[:completed] %> <%= l(:label_show_completed_versions) %></label>
41 <p><%= submit_tag l(:button_apply), :class => 'button-small' %></p>
41 <p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
42 42 <% end %>
43 43
44 44 <h3><%= l(:label_version_plural) %></h3>
45 45 <% @versions.each do |version| %>
46 46 <%= link_to version.name, :anchor => version.name %><br />
47 47 <% end %>
48 48 <% end %>
49 49
50 50 <% html_title(l(:label_roadmap)) %>
General Comments 0
You need to be logged in to leave comments. Login now