##// END OF EJS Templates
Makes saved query filters visible (#2883)....
Jean-Philippe Lang -
r2778:b4c55ea4dee9
parent child
Show More
@@ -1,56 +1,52
1 <% form_tag({}, :id => 'query_form') do %>
2 <% if @query.new_record? %>
3 1 <h2><%= l(:label_calendar) %></h2>
2
3 <% form_tag({}, :id => 'query_form') do %>
4 4 <fieldset id="filters" class="collapsible">
5 5 <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend>
6 6 <div>
7 7 <%= render :partial => 'queries/filters', :locals => {:query => @query} %>
8 8 </div>
9 9 </fieldset>
10 <% else %>
11 <h2><%=h @query.name %></h2>
12 <% html_title @query.name %>
13 <% end %>
14 10
15 11 <p style="float:right;">
16 12 <%= link_to_remote ('&#171; ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")),
17 13 {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) }},
18 14 {:href => url_for(:action => 'calendar', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1))}
19 15 %> |
20 16 <%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' &#187;'),
21 17 {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) }},
22 18 {:href => url_for(:action => 'calendar', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1))}
23 19 %>
24 20 </p>
25 21
26 22 <p class="buttons">
27 23 <%= select_month(@month, :prefix => "month", :discard_type => true) %>
28 24 <%= select_year(@year, :prefix => "year", :discard_type => true) %>
29 25
30 26 <%= link_to_remote l(:button_apply),
31 27 { :url => { :set_filter => (@query.new_record? ? 1 : nil) },
32 28 :update => "content",
33 29 :with => "Form.serialize('query_form')"
34 30 }, :class => 'icon icon-checked' %>
35 31
36 32 <%= link_to_remote l(:button_clear),
37 33 { :url => { :set_filter => (@query.new_record? ? 1 : nil) },
38 34 :update => "content",
39 35 }, :class => 'icon icon-reload' if @query.new_record? %>
40 36 </p>
41 37 <% end %>
42 38
43 39 <%= error_messages_for 'query' %>
44 40 <% if @query.valid? %>
45 41 <%= render :partial => 'common/calendar', :locals => {:calendar => @calendar} %>
46 42
47 43 <%= image_tag 'arrow_from.png' %>&nbsp;&nbsp;<%= l(:text_tip_task_begin_day) %><br />
48 44 <%= image_tag 'arrow_to.png' %>&nbsp;&nbsp;<%= l(:text_tip_task_end_day) %><br />
49 45 <%= image_tag 'arrow_bw.png' %>&nbsp;&nbsp;<%= l(:text_tip_task_begin_end_day) %><br />
50 46 <% end %>
51 47
52 48 <% content_for :sidebar do %>
53 49 <%= render :partial => 'issues/sidebar' %>
54 50 <% end %>
55 51
56 52 <% html_title(l(:label_calendar)) -%>
@@ -1,255 +1,251
1 <h2><%= l(:label_gantt) %></h2>
2
1 3 <% form_tag(params.merge(:month => nil, :year => nil, :months => nil), :id => 'query_form') do %>
2 <% if @query.new_record? %>
3 <h2><%=l(:label_gantt)%></h2>
4 4 <fieldset id="filters" class="collapsible">
5 5 <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend>
6 6 <div>
7 7 <%= render :partial => 'queries/filters', :locals => {:query => @query} %>
8 8 </div>
9 9 </fieldset>
10 <% else %>
11 <h2><%=h @query.name %></h2>
12 <% html_title @query.name %>
13 <% end %>
14 10
15 11 <p style="float:right;">
16 12 <%= if @gantt.zoom < 4
17 13 link_to_remote image_tag('zoom_in.png'), {:url => @gantt.params.merge(:zoom => (@gantt.zoom+1)), :update => 'content'}, {:href => url_for(@gantt.params.merge(:zoom => (@gantt.zoom+1)))}
18 14 else
19 15 image_tag 'zoom_in_g.png'
20 16 end %>
21 17 <%= if @gantt.zoom > 1
22 18 link_to_remote image_tag('zoom_out.png'), {:url => @gantt.params.merge(:zoom => (@gantt.zoom-1)), :update => 'content'}, {:href => url_for(@gantt.params.merge(:zoom => (@gantt.zoom-1)))}
23 19 else
24 20 image_tag 'zoom_out_g.png'
25 21 end %>
26 22 </p>
27 23
28 24 <p class="buttons">
29 25 <%= text_field_tag 'months', @gantt.months, :size => 2 %>
30 26 <%= l(:label_months_from) %>
31 27 <%= select_month(@gantt.month_from, :prefix => "month", :discard_type => true) %>
32 28 <%= select_year(@gantt.year_from, :prefix => "year", :discard_type => true) %>
33 29 <%= hidden_field_tag 'zoom', @gantt.zoom %>
34 30
35 31 <%= link_to_remote l(:button_apply),
36 32 { :url => { :set_filter => (@query.new_record? ? 1 : nil) },
37 33 :update => "content",
38 34 :with => "Form.serialize('query_form')"
39 35 }, :class => 'icon icon-checked' %>
40 36
41 37 <%= link_to_remote l(:button_clear),
42 38 { :url => { :set_filter => (@query.new_record? ? 1 : nil) },
43 39 :update => "content",
44 40 }, :class => 'icon icon-reload' if @query.new_record? %>
45 41 </p>
46 42 <% end %>
47 43
48 44 <%= error_messages_for 'query' %>
49 45 <% if @query.valid? %>
50 46 <% zoom = 1
51 47 @gantt.zoom.times { zoom = zoom * 2 }
52 48
53 49 subject_width = 330
54 50 header_heigth = 18
55 51
56 52 headers_height = header_heigth
57 53 show_weeks = false
58 54 show_days = false
59 55
60 56 if @gantt.zoom >1
61 57 show_weeks = true
62 58 headers_height = 2*header_heigth
63 59 if @gantt.zoom > 2
64 60 show_days = true
65 61 headers_height = 3*header_heigth
66 62 end
67 63 end
68 64
69 65 g_width = (@gantt.date_to - @gantt.date_from + 1)*zoom
70 66 g_height = [(20 * @gantt.events.length + 6)+150, 206].max
71 67 t_height = g_height + headers_height
72 68 %>
73 69
74 70 <table width="100%" style="border:0; border-collapse: collapse;">
75 71 <tr>
76 72 <td style="width:<%= subject_width %>px; padding:0px;">
77 73
78 74 <div style="position:relative;height:<%= t_height + 24 %>px;width:<%= subject_width + 1 %>px;">
79 75 <div style="right:-2px;width:<%= subject_width %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr"></div>
80 76 <div style="right:-2px;width:<%= subject_width %>px;height:<%= t_height %>px;border-left: 1px solid #c0c0c0;overflow:hidden;" class="gantt_hdr"></div>
81 77 <%
82 78 #
83 79 # Tasks subjects
84 80 #
85 81 top = headers_height + 8
86 82 @gantt.events.each do |i| %>
87 83 <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"><small>
88 84 <% if i.is_a? Issue %>
89 85 <%= h("#{i.project} -") unless @project && @project == i.project %>
90 86 <%= link_to_issue i %>: <%=h i.subject %>
91 87 <% else %>
92 88 <span class="icon icon-package">
93 89 <%= h("#{i.project} -") unless @project && @project == i.project %>
94 90 <%= link_to_version i %>
95 91 </span>
96 92 <% end %>
97 93 </small></div>
98 94 <% top = top + 20
99 95 end %>
100 96 </div>
101 97 </td>
102 98 <td>
103 99
104 100 <div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;">
105 101 <div style="width:<%= g_width-1 %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr">&nbsp;</div>
106 102 <%
107 103 #
108 104 # Months headers
109 105 #
110 106 month_f = @gantt.date_from
111 107 left = 0
112 108 height = (show_weeks ? header_heigth : header_heigth + g_height)
113 109 @gantt.months.times do
114 110 width = ((month_f >> 1) - month_f) * zoom - 1
115 111 %>
116 112 <div style="left:<%= left %>px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">
117 113 <%= 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}"%>
118 114 </div>
119 115 <%
120 116 left = left + width + 1
121 117 month_f = month_f >> 1
122 118 end %>
123 119
124 120 <%
125 121 #
126 122 # Weeks headers
127 123 #
128 124 if show_weeks
129 125 left = 0
130 126 height = (show_days ? header_heigth-1 : header_heigth-1 + g_height)
131 127 if @gantt.date_from.cwday == 1
132 128 # @date_from is monday
133 129 week_f = @gantt.date_from
134 130 else
135 131 # find next monday after @date_from
136 132 week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1)
137 133 width = (7 - @gantt.date_from.cwday + 1) * zoom-1
138 134 %>
139 135 <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">&nbsp;</div>
140 136 <%
141 137 left = left + width+1
142 138 end %>
143 139 <%
144 140 while week_f <= @gantt.date_to
145 141 width = (week_f + 6 <= @gantt.date_to) ? 7 * zoom -1 : (@gantt.date_to - week_f + 1) * zoom-1
146 142 %>
147 143 <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">
148 144 <small><%= week_f.cweek if width >= 16 %></small>
149 145 </div>
150 146 <%
151 147 left = left + width+1
152 148 week_f = week_f+7
153 149 end
154 150 end %>
155 151
156 152 <%
157 153 #
158 154 # Days headers
159 155 #
160 156 if show_days
161 157 left = 0
162 158 height = g_height + header_heigth - 1
163 159 wday = @gantt.date_from.cwday
164 160 (@gantt.date_to - @gantt.date_from + 1).to_i.times do
165 161 width = zoom - 1
166 162 %>
167 163 <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">
168 164 <%= day_name(wday).first %>
169 165 </div>
170 166 <%
171 167 left = left + width+1
172 168 wday = wday + 1
173 169 wday = 1 if wday > 7
174 170 end
175 171 end %>
176 172
177 173 <%
178 174 #
179 175 # Tasks
180 176 #
181 177 top = headers_height + 10
182 178 @gantt.events.each do |i|
183 179 if i.is_a? Issue
184 180 i_start_date = (i.start_date >= @gantt.date_from ? i.start_date : @gantt.date_from )
185 181 i_end_date = (i.due_before <= @gantt.date_to ? i.due_before : @gantt.date_to )
186 182
187 183 i_done_date = i.start_date + ((i.due_before - i.start_date+1)*i.done_ratio/100).floor
188 184 i_done_date = (i_done_date <= @gantt.date_from ? @gantt.date_from : i_done_date )
189 185 i_done_date = (i_done_date >= @gantt.date_to ? @gantt.date_to : i_done_date )
190 186
191 187 i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today
192 188
193 189 i_left = ((i_start_date - @gantt.date_from)*zoom).floor
194 190 i_width = ((i_end_date - i_start_date + 1)*zoom).floor - 2 # total width of the issue (- 2 for left and right borders)
195 191 d_width = ((i_done_date - i_start_date)*zoom).floor - 2 # done width
196 192 l_width = i_late_date ? ((i_late_date - i_start_date+1)*zoom).floor - 2 : 0 # delay width
197 193 %>
198 194 <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;" class="task task_todo">&nbsp;</div>
199 195 <% if l_width > 0 %>
200 196 <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= l_width %>px;" class="task task_late">&nbsp;</div>
201 197 <% end %>
202 198 <% if d_width > 0 %>
203 199 <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= d_width %>px;" class="task task_done">&nbsp;</div>
204 200 <% end %>
205 201 <div style="top:<%= top %>px;left:<%= i_left + i_width + 5 %>px;background:#fff;" class="task">
206 202 <%= i.status.name %>
207 203 <%= (i.done_ratio).to_i %>%
208 204 </div>
209 205 <div class="tooltip" style="position: absolute;top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;height:12px;">
210 206 <span class="tip">
211 207 <%= render_issue_tooltip i %>
212 208 </span></div>
213 209 <% else
214 210 i_left = ((i.start_date - @gantt.date_from)*zoom).floor
215 211 %>
216 212 <div style="top:<%= top %>px;left:<%= i_left %>px;width:15px;" class="task milestone">&nbsp;</div>
217 213 <div style="top:<%= top %>px;left:<%= i_left + 12 %>px;background:#fff;" class="task">
218 214 <%= h("#{i.project} -") unless @project && @project == i.project %>
219 215 <strong><%=h i %></strong>
220 216 </div>
221 217 <% end %>
222 218 <% top = top + 20
223 219 end %>
224 220
225 221 <%
226 222 #
227 223 # Today red line (excluded from cache)
228 224 #
229 225 if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %>
230 226 <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;">&nbsp;</div>
231 227 <% end %>
232 228
233 229 </div>
234 230 </td>
235 231 </tr>
236 232 </table>
237 233
238 234 <table width="100%">
239 235 <tr>
240 236 <td align="left"><%= link_to_remote ('&#171; ' + l(:label_previous)), {:url => @gantt.params_previous, :update => 'content', :complete => 'window.scrollTo(0,0)'}, {:href => url_for(@gantt.params_previous)} %></td>
241 237 <td align="right"><%= link_to_remote (l(:label_next) + ' &#187;'), {:url => @gantt.params_next, :update => 'content', :complete => 'window.scrollTo(0,0)'}, {:href => url_for(@gantt.params_next)} %></td>
242 238 </tr>
243 239 </table>
244 240
245 241 <% other_formats_links do |f| %>
246 242 <%= f.link_to 'PDF', :url => @gantt.params %>
247 243 <%= f.link_to('PNG', :url => @gantt.params) if @gantt.respond_to?('to_image') %>
248 244 <% end %>
249 245 <% end # query.valid? %>
250 246
251 247 <% content_for :sidebar do %>
252 248 <%= render :partial => 'issues/sidebar' %>
253 249 <% end %>
254 250
255 251 <% html_title(l(:label_gantt)) -%>
@@ -1,82 +1,77
1 <% if @query.new_record? %>
2 <h2><%=l(:label_issue_plural)%></h2>
3 <% html_title(l(:label_issue_plural)) %>
4
5 <% form_tag({ :controller => 'queries', :action => 'new' }, :id => 'query_form') do %>
1 <div class="contextual">
2 <% if !@query.new_record? && @query.editable_by?(User.current) %>
3 <%= link_to l(:button_edit), {:controller => 'queries', :action => 'edit', :id => @query}, :class => 'icon icon-edit' %>
4 <%= link_to l(:button_delete), {:controller => 'queries', :action => 'destroy', :id => @query}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
5 <% end %>
6 </div>
7
8 <h2><%= @query.new_record? ? l(:label_issue_plural) : h(@query.name) %></h2>
9 <% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %>
10
11 <% form_tag({ :controller => 'queries', :action => 'new' }, :id => 'query_form') do %>
6 12 <%= hidden_field_tag('project_id', @project.to_param) if @project %>
7 13 <div id="query_form_content">
8 14 <fieldset id="filters" class="collapsible">
9 15 <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend>
10 16 <div>
11 17 <%= render :partial => 'queries/filters', :locals => {:query => @query} %>
12 18 </div>
13 19 </fieldset>
14 20 <fieldset class="collapsible collapsed">
15 21 <legend onclick="toggleFieldset(this);">Options</legend>
16 22 <div style="display: none;">
17 23 <%= l(:field_group_by) %>
18 24 <%= select_tag('group_by', options_for_select([[]] + @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, @query.group_by)) %></p>
19 25 </div>
20 26 </fieldset>
21 27 </div>
22 28 <p class="buttons">
23 29
24 30 <%= link_to_remote l(:button_apply),
25 31 { :url => { :set_filter => 1 },
26 32 :update => "content",
27 33 :with => "Form.serialize('query_form')"
28 34 }, :class => 'icon icon-checked' %>
29 35
30 36 <%= link_to_remote l(:button_clear),
31 37 { :url => { :set_filter => 1, :project_id => @project },
32 38 :method => :get,
33 39 :update => "content",
34 40 }, :class => 'icon icon-reload' %>
35 41
36 <% if User.current.allowed_to?(:save_queries, @project, :global => true) %>
42 <% if @query.new_record? && User.current.allowed_to?(:save_queries, @project, :global => true) %>
37 43 <%= link_to l(:button_save), {}, :onclick => "$('query_form').submit(); return false;", :class => 'icon icon-save' %>
38 44 <% end %>
39 45 </p>
40 <% end %>
41 <% else %>
42 <div class="contextual">
43 <% if @query.editable_by?(User.current) %>
44 <%= link_to l(:button_edit), {:controller => 'queries', :action => 'edit', :id => @query}, :class => 'icon icon-edit' %>
45 <%= link_to l(:button_delete), {:controller => 'queries', :action => 'destroy', :id => @query}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
46 <% end %>
47 </div>
48 <h2><%=h @query.name %></h2>
49 <div id="query_form"></div>
50 <% html_title @query.name %>
51 46 <% end %>
52 47
53 48 <%= error_messages_for 'query' %>
54 49 <% if @query.valid? %>
55 50 <% if @issues.empty? %>
56 51 <p class="nodata"><%= l(:label_no_data) %></p>
57 52 <% else %>
58 53 <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %>
59 54 <p class="pagination"><%= pagination_links_full @issue_pages, @issue_count %></p>
60 55 <% end %>
61 56
62 57 <% other_formats_links do |f| %>
63 58 <%= f.link_to 'Atom', :url => { :project_id => @project, :query_id => (@query.new_record? ? nil : @query), :key => User.current.rss_key } %>
64 59 <%= f.link_to 'CSV', :url => { :project_id => @project } %>
65 60 <%= f.link_to 'PDF', :url => { :project_id => @project } %>
66 61 <% end %>
67 62
68 63 <% end %>
69 64
70 65 <% content_for :sidebar do %>
71 66 <%= render :partial => 'issues/sidebar' %>
72 67 <% end %>
73 68
74 69 <% content_for :header_tags do %>
75 70 <%= auto_discovery_link_tag(:atom, {:query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_issue_plural)) %>
76 71 <%= auto_discovery_link_tag(:atom, {:action => 'changes', :query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_changes_details)) %>
77 72 <%= javascript_include_tag 'context_menu' %>
78 73 <%= stylesheet_link_tag 'context_menu' %>
79 74 <% end %>
80 75
81 76 <div id="context-menu" style="display: none;"></div>
82 77 <%= javascript_tag "new ContextMenu('#{url_for(:controller => 'issues', :action => 'context_menu')}')" %>
General Comments 0
You need to be logged in to leave comments. Login now