The requested changes are too big and content was truncated. Show full diff
@@ -1,246 +1,276 | |||||
1 | # encoding: utf-8 |
|
1 | # encoding: utf-8 | |
2 | # |
|
2 | # | |
3 | # Redmine - project management software |
|
3 | # Redmine - project management software | |
4 | # Copyright (C) 2006-2015 Jean-Philippe Lang |
|
4 | # Copyright (C) 2006-2015 Jean-Philippe Lang | |
5 | # |
|
5 | # | |
6 | # This program is free software; you can redistribute it and/or |
|
6 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License |
|
7 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; either version 2 |
|
8 | # as published by the Free Software Foundation; either version 2 | |
9 | # of the License, or (at your option) any later version. |
|
9 | # of the License, or (at your option) any later version. | |
10 | # |
|
10 | # | |
11 | # This program is distributed in the hope that it will be useful, |
|
11 | # This program is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. |
|
14 | # GNU General Public License for more details. | |
15 | # |
|
15 | # | |
16 | # You should have received a copy of the GNU General Public License |
|
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with this program; if not, write to the Free Software |
|
17 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 |
|
19 | |||
20 | module QueriesHelper |
|
20 | module QueriesHelper | |
21 | include ApplicationHelper |
|
21 | include ApplicationHelper | |
22 |
|
22 | |||
23 | def filters_options_for_select(query) |
|
23 | def filters_options_for_select(query) | |
24 | ungrouped = [] |
|
24 | ungrouped = [] | |
25 | grouped = {} |
|
25 | grouped = {} | |
26 | query.available_filters.map do |field, field_options| |
|
26 | query.available_filters.map do |field, field_options| | |
27 | if [:tree, :relation].include?(field_options[:type]) |
|
27 | if [:tree, :relation].include?(field_options[:type]) | |
28 | group = :label_related_issues |
|
28 | group = :label_related_issues | |
29 | elsif field =~ /^(.+)\./ |
|
29 | elsif field =~ /^(.+)\./ | |
30 | # association filters |
|
30 | # association filters | |
31 | group = "field_#{$1}" |
|
31 | group = "field_#{$1}" | |
32 | elsif %w(member_of_group assigned_to_role).include?(field) |
|
32 | elsif %w(member_of_group assigned_to_role).include?(field) | |
33 | group = :field_assigned_to |
|
33 | group = :field_assigned_to | |
34 | elsif field_options[:type] == :date_past || field_options[:type] == :date |
|
34 | elsif field_options[:type] == :date_past || field_options[:type] == :date | |
35 | group = :label_date |
|
35 | group = :label_date | |
36 | end |
|
36 | end | |
37 | if group |
|
37 | if group | |
38 | (grouped[group] ||= []) << [field_options[:name], field] |
|
38 | (grouped[group] ||= []) << [field_options[:name], field] | |
39 | else |
|
39 | else | |
40 | ungrouped << [field_options[:name], field] |
|
40 | ungrouped << [field_options[:name], field] | |
41 | end |
|
41 | end | |
42 | end |
|
42 | end | |
43 | # Don't group dates if there's only one (eg. time entries filters) |
|
43 | # Don't group dates if there's only one (eg. time entries filters) | |
44 | if grouped[:label_date].try(:size) == 1 |
|
44 | if grouped[:label_date].try(:size) == 1 | |
45 | ungrouped << grouped.delete(:label_date).first |
|
45 | ungrouped << grouped.delete(:label_date).first | |
46 | end |
|
46 | end | |
47 | s = options_for_select([[]] + ungrouped) |
|
47 | s = options_for_select([[]] + ungrouped) | |
48 | if grouped.present? |
|
48 | if grouped.present? | |
49 | localized_grouped = grouped.map {|k,v| [l(k), v]} |
|
49 | localized_grouped = grouped.map {|k,v| [l(k), v]} | |
50 | s << grouped_options_for_select(localized_grouped) |
|
50 | s << grouped_options_for_select(localized_grouped) | |
51 | end |
|
51 | end | |
52 | s |
|
52 | s | |
53 | end |
|
53 | end | |
54 |
|
54 | |||
55 | def query_filters_hidden_tags(query) |
|
55 | def query_filters_hidden_tags(query) | |
56 | tags = ''.html_safe |
|
56 | tags = ''.html_safe | |
57 | query.filters.each do |field, options| |
|
57 | query.filters.each do |field, options| | |
58 | tags << hidden_field_tag("f[]", field, :id => nil) |
|
58 | tags << hidden_field_tag("f[]", field, :id => nil) | |
59 | tags << hidden_field_tag("op[#{field}]", options[:operator], :id => nil) |
|
59 | tags << hidden_field_tag("op[#{field}]", options[:operator], :id => nil) | |
60 | options[:values].each do |value| |
|
60 | options[:values].each do |value| | |
61 | tags << hidden_field_tag("v[#{field}][]", value, :id => nil) |
|
61 | tags << hidden_field_tag("v[#{field}][]", value, :id => nil) | |
62 | end |
|
62 | end | |
63 | end |
|
63 | end | |
64 | tags |
|
64 | tags | |
65 | end |
|
65 | end | |
66 |
|
66 | |||
67 | def query_columns_hidden_tags(query) |
|
67 | def query_columns_hidden_tags(query) | |
68 | tags = ''.html_safe |
|
68 | tags = ''.html_safe | |
69 | query.columns.each do |column| |
|
69 | query.columns.each do |column| | |
70 | tags << hidden_field_tag("c[]", column.name, :id => nil) |
|
70 | tags << hidden_field_tag("c[]", column.name, :id => nil) | |
71 | end |
|
71 | end | |
72 | tags |
|
72 | tags | |
73 | end |
|
73 | end | |
74 |
|
74 | |||
75 | def query_hidden_tags(query) |
|
75 | def query_hidden_tags(query) | |
76 | query_filters_hidden_tags(query) + query_columns_hidden_tags(query) |
|
76 | query_filters_hidden_tags(query) + query_columns_hidden_tags(query) | |
77 | end |
|
77 | end | |
78 |
|
78 | |||
79 | def available_block_columns_tags(query) |
|
79 | def available_block_columns_tags(query) | |
80 | tags = ''.html_safe |
|
80 | tags = ''.html_safe | |
81 | query.available_block_columns.each do |column| |
|
81 | query.available_block_columns.each do |column| | |
82 | tags << content_tag('label', check_box_tag('c[]', column.name.to_s, query.has_column?(column), :id => nil) + " #{column.caption}", :class => 'inline') |
|
82 | tags << content_tag('label', check_box_tag('c[]', column.name.to_s, query.has_column?(column), :id => nil) + " #{column.caption}", :class => 'inline') | |
83 | end |
|
83 | end | |
84 | tags |
|
84 | tags | |
85 | end |
|
85 | end | |
86 |
|
86 | |||
87 | def available_totalable_columns_tags(query) |
|
87 | def available_totalable_columns_tags(query) | |
88 | tags = ''.html_safe |
|
88 | tags = ''.html_safe | |
89 | query.available_totalable_columns.each do |column| |
|
89 | query.available_totalable_columns.each do |column| | |
90 | tags << content_tag('label', check_box_tag('t[]', column.name.to_s, query.totalable_columns.include?(column), :id => nil) + " #{column.caption}", :class => 'inline') |
|
90 | tags << content_tag('label', check_box_tag('t[]', column.name.to_s, query.totalable_columns.include?(column), :id => nil) + " #{column.caption}", :class => 'inline') | |
91 | end |
|
91 | end | |
92 | tags |
|
92 | tags | |
93 | end |
|
93 | end | |
94 |
|
94 | |||
95 | def query_available_inline_columns_options(query) |
|
95 | def query_available_inline_columns_options(query) | |
96 | (query.available_inline_columns - query.columns).reject(&:frozen?).collect {|column| [column.caption, column.name]} |
|
96 | (query.available_inline_columns - query.columns).reject(&:frozen?).collect {|column| [column.caption, column.name]} | |
97 | end |
|
97 | end | |
98 |
|
98 | |||
99 | def query_selected_inline_columns_options(query) |
|
99 | def query_selected_inline_columns_options(query) | |
100 | (query.inline_columns & query.available_inline_columns).reject(&:frozen?).collect {|column| [column.caption, column.name]} |
|
100 | (query.inline_columns & query.available_inline_columns).reject(&:frozen?).collect {|column| [column.caption, column.name]} | |
101 | end |
|
101 | end | |
102 |
|
102 | |||
103 | def render_query_columns_selection(query, options={}) |
|
103 | def render_query_columns_selection(query, options={}) | |
104 | tag_name = (options[:name] || 'c') + '[]' |
|
104 | tag_name = (options[:name] || 'c') + '[]' | |
105 | render :partial => 'queries/columns', :locals => {:query => query, :tag_name => tag_name} |
|
105 | render :partial => 'queries/columns', :locals => {:query => query, :tag_name => tag_name} | |
106 | end |
|
106 | end | |
107 |
|
107 | |||
108 | def render_query_totals(query) |
|
108 | def render_query_totals(query) | |
109 | return unless query.totalable_columns.present? |
|
109 | return unless query.totalable_columns.present? | |
110 | totals = query.totalable_columns.map do |column| |
|
110 | totals = query.totalable_columns.map do |column| | |
111 | total_tag(column, query.total_for(column)) |
|
111 | total_tag(column, query.total_for(column)) | |
112 | end |
|
112 | end | |
113 | content_tag('p', totals.join(" ").html_safe, :class => "query-totals") |
|
113 | content_tag('p', totals.join(" ").html_safe, :class => "query-totals") | |
114 | end |
|
114 | end | |
115 |
|
115 | |||
116 | def total_tag(column, value) |
|
116 | def total_tag(column, value) | |
117 | label = content_tag('span', "#{column.caption}:") |
|
117 | label = content_tag('span', "#{column.caption}:") | |
118 | value = content_tag('span', format_object(value), :class => 'value') |
|
118 | value = content_tag('span', format_object(value), :class => 'value') | |
119 | content_tag('span', label + " " + value, :class => "total-for-#{column.name.to_s.dasherize}") |
|
119 | content_tag('span', label + " " + value, :class => "total-for-#{column.name.to_s.dasherize}") | |
120 | end |
|
120 | end | |
121 |
|
121 | |||
122 | def column_header(column) |
|
122 | def column_header(column) | |
123 | column.sortable ? sort_header_tag(column.name.to_s, :caption => column.caption, |
|
123 | column.sortable ? sort_header_tag(column.name.to_s, :caption => column.caption, | |
124 | :default_order => column.default_order) : |
|
124 | :default_order => column.default_order) : | |
125 | content_tag('th', h(column.caption)) |
|
125 | content_tag('th', h(column.caption)) | |
126 | end |
|
126 | end | |
127 |
|
127 | |||
128 | def column_content(column, issue) |
|
128 | def column_content(column, issue) | |
129 | value = column.value_object(issue) |
|
129 | value = column.value_object(issue) | |
130 | if value.is_a?(Array) |
|
130 | if value.is_a?(Array) | |
131 | value.collect {|v| column_value(column, issue, v)}.compact.join(', ').html_safe |
|
131 | value.collect {|v| column_value(column, issue, v)}.compact.join(', ').html_safe | |
132 | else |
|
132 | else | |
133 | column_value(column, issue, value) |
|
133 | column_value(column, issue, value) | |
134 | end |
|
134 | end | |
135 | end |
|
135 | end | |
136 |
|
136 | |||
137 | def column_value(column, issue, value) |
|
137 | def column_value(column, issue, value) | |
138 | case column.name |
|
138 | case column.name | |
139 | when :id |
|
139 | when :id | |
140 | link_to value, issue_path(issue) |
|
140 | link_to value, issue_path(issue) | |
141 | when :subject |
|
141 | when :subject | |
142 | link_to value, issue_path(issue) |
|
142 | link_to value, issue_path(issue) | |
143 | when :parent |
|
143 | when :parent | |
144 | value ? (value.visible? ? link_to_issue(value, :subject => false) : "##{value.id}") : '' |
|
144 | value ? (value.visible? ? link_to_issue(value, :subject => false) : "##{value.id}") : '' | |
145 | when :description |
|
145 | when :description | |
146 | issue.description? ? content_tag('div', textilizable(issue, :description), :class => "wiki") : '' |
|
146 | issue.description? ? content_tag('div', textilizable(issue, :description), :class => "wiki") : '' | |
147 | when :done_ratio |
|
147 | when :done_ratio | |
148 | progress_bar(value) |
|
148 | progress_bar(value) | |
149 | when :relations |
|
149 | when :relations | |
150 | content_tag('span', |
|
150 | content_tag('span', | |
151 | value.to_s(issue) {|other| link_to_issue(other, :subject => false, :tracker => false)}.html_safe, |
|
151 | value.to_s(issue) {|other| link_to_issue(other, :subject => false, :tracker => false)}.html_safe, | |
152 | :class => value.css_classes_for(issue)) |
|
152 | :class => value.css_classes_for(issue)) | |
153 | else |
|
153 | else | |
154 | format_object(value) |
|
154 | format_object(value) | |
155 | end |
|
155 | end | |
156 | end |
|
156 | end | |
157 |
|
157 | |||
158 | def csv_content(column, issue) |
|
158 | def csv_content(column, issue) | |
159 | value = column.value_object(issue) |
|
159 | value = column.value_object(issue) | |
160 | if value.is_a?(Array) |
|
160 | if value.is_a?(Array) | |
161 | value.collect {|v| csv_value(column, issue, v)}.compact.join(', ') |
|
161 | value.collect {|v| csv_value(column, issue, v)}.compact.join(', ') | |
162 | else |
|
162 | else | |
163 | csv_value(column, issue, value) |
|
163 | csv_value(column, issue, value) | |
164 | end |
|
164 | end | |
165 | end |
|
165 | end | |
166 |
|
166 | |||
167 | def csv_value(column, object, value) |
|
167 | def csv_value(column, object, value) | |
168 | format_object(value, false) do |value| |
|
168 | format_object(value, false) do |value| | |
169 | case value.class.name |
|
169 | case value.class.name | |
170 | when 'Float' |
|
170 | when 'Float' | |
171 | sprintf("%.2f", value).gsub('.', l(:general_csv_decimal_separator)) |
|
171 | sprintf("%.2f", value).gsub('.', l(:general_csv_decimal_separator)) | |
172 | when 'IssueRelation' |
|
172 | when 'IssueRelation' | |
173 | value.to_s(object) |
|
173 | value.to_s(object) | |
174 | when 'Issue' |
|
174 | when 'Issue' | |
175 | if object.is_a?(TimeEntry) |
|
175 | if object.is_a?(TimeEntry) | |
176 | "#{value.tracker} ##{value.id}: #{value.subject}" |
|
176 | "#{value.tracker} ##{value.id}: #{value.subject}" | |
177 | else |
|
177 | else | |
178 | value.id |
|
178 | value.id | |
179 | end |
|
179 | end | |
180 | else |
|
180 | else | |
181 | value |
|
181 | value | |
182 | end |
|
182 | end | |
183 | end |
|
183 | end | |
184 | end |
|
184 | end | |
185 |
|
185 | |||
186 | def query_to_csv(items, query, options={}) |
|
186 | def query_to_csv(items, query, options={}) | |
187 | options ||= {} |
|
187 | options ||= {} | |
188 | columns = (options[:columns] == 'all' ? query.available_inline_columns : query.inline_columns) |
|
188 | columns = (options[:columns] == 'all' ? query.available_inline_columns : query.inline_columns) | |
189 | query.available_block_columns.each do |column| |
|
189 | query.available_block_columns.each do |column| | |
190 | if options[column.name].present? |
|
190 | if options[column.name].present? | |
191 | columns << column |
|
191 | columns << column | |
192 | end |
|
192 | end | |
193 | end |
|
193 | end | |
194 |
|
194 | |||
195 | Redmine::Export::CSV.generate do |csv| |
|
195 | Redmine::Export::CSV.generate do |csv| | |
196 | # csv header fields |
|
196 | # csv header fields | |
197 | csv << columns.map {|c| c.caption.to_s} |
|
197 | csv << columns.map {|c| c.caption.to_s} | |
198 | # csv lines |
|
198 | # csv lines | |
199 | items.each do |item| |
|
199 | items.each do |item| | |
200 | csv << columns.map {|c| csv_content(c, item)} |
|
200 | csv << columns.map {|c| csv_content(c, item)} | |
201 | end |
|
201 | end | |
202 | end |
|
202 | end | |
203 | end |
|
203 | end | |
204 |
|
204 | |||
205 | # Retrieve query from session or build a new query |
|
205 | # Retrieve query from session or build a new query | |
206 | def retrieve_query |
|
206 | def retrieve_query | |
207 | if !params[:query_id].blank? |
|
207 | if !params[:query_id].blank? | |
208 | cond = "project_id IS NULL" |
|
208 | cond = "project_id IS NULL" | |
209 | cond << " OR project_id = #{@project.id}" if @project |
|
209 | cond << " OR project_id = #{@project.id}" if @project | |
210 | @query = IssueQuery.where(cond).find(params[:query_id]) |
|
210 | @query = IssueQuery.where(cond).find(params[:query_id]) | |
211 | raise ::Unauthorized unless @query.visible? |
|
211 | raise ::Unauthorized unless @query.visible? | |
212 | @query.project = @project |
|
212 | @query.project = @project | |
213 | session[:query] = {:id => @query.id, :project_id => @query.project_id} |
|
213 | session[:query] = {:id => @query.id, :project_id => @query.project_id} | |
214 | sort_clear |
|
214 | sort_clear | |
215 | elsif api_request? || params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil) |
|
215 | elsif api_request? || params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil) | |
216 | # Give it a name, required to be valid |
|
216 | # Give it a name, required to be valid | |
217 | @query = IssueQuery.new(:name => "_") |
|
217 | @query = IssueQuery.new(:name => "_") | |
218 | @query.project = @project |
|
218 | @query.project = @project | |
219 | @query.build_from_params(params) |
|
219 | @query.build_from_params(params) | |
220 | session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names, :totalable_names => @query.totalable_names} |
|
220 | session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names, :totalable_names => @query.totalable_names} | |
221 | else |
|
221 | else | |
222 | # retrieve from session |
|
222 | # retrieve from session | |
223 | @query = nil |
|
223 | @query = nil | |
224 | @query = IssueQuery.find_by_id(session[:query][:id]) if session[:query][:id] |
|
224 | @query = IssueQuery.find_by_id(session[:query][:id]) if session[:query][:id] | |
225 | @query ||= IssueQuery.new(:name => "_", :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names], :totalable_names => session[:query][:totalable_names]) |
|
225 | @query ||= IssueQuery.new(:name => "_", :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names], :totalable_names => session[:query][:totalable_names]) | |
226 | @query.project = @project |
|
226 | @query.project = @project | |
227 | end |
|
227 | end | |
228 | end |
|
228 | end | |
229 |
|
229 | |||
230 | def retrieve_query_from_session |
|
230 | def retrieve_query_from_session | |
231 | if session[:query] |
|
231 | if session[:query] | |
232 | if session[:query][:id] |
|
232 | if session[:query][:id] | |
233 | @query = IssueQuery.find_by_id(session[:query][:id]) |
|
233 | @query = IssueQuery.find_by_id(session[:query][:id]) | |
234 | return unless @query |
|
234 | return unless @query | |
235 | else |
|
235 | else | |
236 | @query = IssueQuery.new(:name => "_", :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names], :totalable_names => session[:query][:totalable_names]) |
|
236 | @query = IssueQuery.new(:name => "_", :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names], :totalable_names => session[:query][:totalable_names]) | |
237 | end |
|
237 | end | |
238 | if session[:query].has_key?(:project_id) |
|
238 | if session[:query].has_key?(:project_id) | |
239 | @query.project_id = session[:query][:project_id] |
|
239 | @query.project_id = session[:query][:project_id] | |
240 | else |
|
240 | else | |
241 | @query.project = @project |
|
241 | @query.project = @project | |
242 | end |
|
242 | end | |
243 | @query |
|
243 | @query | |
244 | end |
|
244 | end | |
245 | end |
|
245 | end | |
|
246 | ||||
|
247 | # Returns the query definition as hidden field tags | |||
|
248 | def query_as_hidden_field_tags(query) | |||
|
249 | tags = hidden_field_tag("set_filter", "1", :id => nil) | |||
|
250 | ||||
|
251 | if query.filters.present? | |||
|
252 | query.filters.each do |field, filter| | |||
|
253 | tags << hidden_field_tag("f[]", field, :id => nil) | |||
|
254 | tags << hidden_field_tag("op[#{field}]", filter[:operator], :id => nil) | |||
|
255 | filter[:values].each do |value| | |||
|
256 | tags << hidden_field_tag("v[#{field}][]", value, :id => nil) | |||
|
257 | end | |||
|
258 | end | |||
|
259 | end | |||
|
260 | if query.column_names.present? | |||
|
261 | query.column_names.each do |name| | |||
|
262 | tags << hidden_field_tag("c[]", name, :id => nil) | |||
|
263 | end | |||
|
264 | end | |||
|
265 | if query.totalable_names.present? | |||
|
266 | query.totalable_names.each do |name| | |||
|
267 | tags << hidden_field_tag("t[]", name, :id => nil) | |||
|
268 | end | |||
|
269 | end | |||
|
270 | if query.group_by.present? | |||
|
271 | tags << hidden_field_tag("group_by", query.group_by, :id => nil) | |||
|
272 | end | |||
|
273 | ||||
|
274 | tags | |||
|
275 | end | |||
246 | end |
|
276 | end |
@@ -1,119 +1,121 | |||||
1 | <div class="contextual"> |
|
1 | <div class="contextual"> | |
2 | <% if !@query.new_record? && @query.editable_by?(User.current) %> |
|
2 | <% if !@query.new_record? && @query.editable_by?(User.current) %> | |
3 | <%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %> |
|
3 | <%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %> | |
4 | <%= delete_link query_path(@query) %> |
|
4 | <%= delete_link query_path(@query) %> | |
5 | <% end %> |
|
5 | <% end %> | |
6 | </div> |
|
6 | </div> | |
7 |
|
7 | |||
8 | <h2><%= @query.new_record? ? l(:label_issue_plural) : @query.name %></h2> |
|
8 | <h2><%= @query.new_record? ? l(:label_issue_plural) : @query.name %></h2> | |
9 | <% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %> |
|
9 | <% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %> | |
10 |
|
10 | |||
11 | <%= form_tag({ :controller => 'issues', :action => 'index', :project_id => @project }, |
|
11 | <%= form_tag({ :controller => 'issues', :action => 'index', :project_id => @project }, | |
12 | :method => :get, :id => 'query_form') do %> |
|
12 | :method => :get, :id => 'query_form') do %> | |
13 | <div id="query_form_with_buttons" class="hide-when-print"> |
|
13 | <div id="query_form_with_buttons" class="hide-when-print"> | |
14 | <%= hidden_field_tag 'set_filter', '1' %> |
|
14 | <%= hidden_field_tag 'set_filter', '1' %> | |
15 | <div id="query_form_content"> |
|
15 | <div id="query_form_content"> | |
16 | <fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>"> |
|
16 | <fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>"> | |
17 | <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend> |
|
17 | <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend> | |
18 | <div style="<%= @query.new_record? ? "" : "display: none;" %>"> |
|
18 | <div style="<%= @query.new_record? ? "" : "display: none;" %>"> | |
19 | <%= render :partial => 'queries/filters', :locals => {:query => @query} %> |
|
19 | <%= render :partial => 'queries/filters', :locals => {:query => @query} %> | |
20 | </div> |
|
20 | </div> | |
21 | </fieldset> |
|
21 | </fieldset> | |
22 | <fieldset class="collapsible collapsed"> |
|
22 | <fieldset class="collapsible collapsed"> | |
23 | <legend onclick="toggleFieldset(this);"><%= l(:label_options) %></legend> |
|
23 | <legend onclick="toggleFieldset(this);"><%= l(:label_options) %></legend> | |
24 | <div style="display: none;"> |
|
24 | <div style="display: none;"> | |
25 | <table> |
|
25 | <table> | |
26 | <tr> |
|
26 | <tr> | |
27 | <td><%= l(:field_column_names) %></td> |
|
27 | <td><%= l(:field_column_names) %></td> | |
28 | <td><%= render_query_columns_selection(@query) %></td> |
|
28 | <td><%= render_query_columns_selection(@query) %></td> | |
29 | </tr> |
|
29 | </tr> | |
30 | <tr> |
|
30 | <tr> | |
31 | <td><label for='group_by'><%= l(:field_group_by) %></label></td> |
|
31 | <td><label for='group_by'><%= l(:field_group_by) %></label></td> | |
32 | <td><%= select_tag('group_by', |
|
32 | <td><%= select_tag('group_by', | |
33 | options_for_select( |
|
33 | options_for_select( | |
34 | [[]] + @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, |
|
34 | [[]] + @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, | |
35 | @query.group_by) |
|
35 | @query.group_by) | |
36 | ) %></td> |
|
36 | ) %></td> | |
37 | </tr> |
|
37 | </tr> | |
38 | <tr> |
|
38 | <tr> | |
39 | <td><%= l(:button_show) %></td> |
|
39 | <td><%= l(:button_show) %></td> | |
40 | <td><%= available_block_columns_tags(@query) %></td> |
|
40 | <td><%= available_block_columns_tags(@query) %></td> | |
41 | </tr> |
|
41 | </tr> | |
42 | <tr> |
|
42 | <tr> | |
43 | <td><%= l(:label_total_plural) %></td> |
|
43 | <td><%= l(:label_total_plural) %></td> | |
44 | <td><%= available_totalable_columns_tags(@query) %></td> |
|
44 | <td><%= available_totalable_columns_tags(@query) %></td> | |
45 | </tr> |
|
45 | </tr> | |
46 | </table> |
|
46 | </table> | |
47 | </div> |
|
47 | </div> | |
48 | </fieldset> |
|
48 | </fieldset> | |
49 | </div> |
|
49 | </div> | |
50 | <p class="buttons"> |
|
50 | <p class="buttons"> | |
51 | <%= link_to_function l(:button_apply), '$("#query_form").submit()', :class => 'icon icon-checked' %> |
|
51 | <%= link_to_function l(:button_apply), '$("#query_form").submit()', :class => 'icon icon-checked' %> | |
52 | <%= link_to l(:button_clear), { :set_filter => 1, :project_id => @project }, :class => 'icon icon-reload' %> |
|
52 | <%= link_to l(:button_clear), { :set_filter => 1, :project_id => @project }, :class => 'icon icon-reload' %> | |
53 | <% if @query.new_record? && User.current.allowed_to?(:save_queries, @project, :global => true) %> |
|
53 | <% if @query.new_record? && User.current.allowed_to?(:save_queries, @project, :global => true) %> | |
54 | <%= link_to_function l(:button_save), |
|
54 | <%= link_to_function l(:button_save), | |
55 | "$('#query_form').attr('action', '#{ @project ? new_project_query_path(@project) : new_query_path }').submit()", |
|
55 | "$('#query_form').attr('action', '#{ @project ? new_project_query_path(@project) : new_query_path }').submit()", | |
56 | :class => 'icon icon-save' %> |
|
56 | :class => 'icon icon-save' %> | |
57 | <% end %> |
|
57 | <% end %> | |
58 | </p> |
|
58 | </p> | |
59 | </div> |
|
59 | </div> | |
60 | <% end %> |
|
60 | <% end %> | |
61 |
|
61 | |||
62 | <%= error_messages_for 'query' %> |
|
62 | <%= error_messages_for 'query' %> | |
63 | <% if @query.valid? %> |
|
63 | <% if @query.valid? %> | |
64 | <% if @issues.empty? %> |
|
64 | <% if @issues.empty? %> | |
65 | <p class="nodata"><%= l(:label_no_data) %></p> |
|
65 | <p class="nodata"><%= l(:label_no_data) %></p> | |
66 | <% else %> |
|
66 | <% else %> | |
67 | <%= render_query_totals(@query) %> |
|
67 | <%= render_query_totals(@query) %> | |
68 | <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> |
|
68 | <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> | |
69 | <span class="pagination"><%= pagination_links_full @issue_pages, @issue_count %></span> |
|
69 | <span class="pagination"><%= pagination_links_full @issue_pages, @issue_count %></span> | |
70 | <% end %> |
|
70 | <% end %> | |
71 |
|
71 | |||
72 | <% other_formats_links do |f| %> |
|
72 | <% other_formats_links do |f| %> | |
73 | <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> |
|
73 | <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> | |
74 | <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '350px'); return false;" %> |
|
74 | <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '350px'); return false;" %> | |
75 | <%= f.link_to 'PDF', :url => params %> |
|
75 | <%= f.link_to 'PDF', :url => params %> | |
76 | <% end %> |
|
76 | <% end %> | |
77 |
|
77 | |||
78 | <div id="csv-export-options" style="display:none;"> |
|
78 | <div id="csv-export-options" style="display:none;"> | |
79 |
<h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3> |
|
79 | <h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3> | |
80 |
<%= form_tag( |
|
80 | <%= form_tag(_project_issues_path(@project, :format => 'csv'), :method => :get, :id => 'csv-export-form') do %> | |
|
81 | <%= query_as_hidden_field_tags(@query) %> | |||
|
82 | <%= hidden_field_tag 'sort', params[:sort], :id => nil %> | |||
81 | <p> |
|
83 | <p> | |
82 | <label><%= radio_button_tag 'csv[columns]', '', true %> <%= l(:description_selected_columns) %></label><br /> |
|
84 | <label><%= radio_button_tag 'csv[columns]', '', true %> <%= l(:description_selected_columns) %></label><br /> | |
83 | <label><%= radio_button_tag 'csv[columns]', 'all' %> <%= l(:description_all_columns) %></label> |
|
85 | <label><%= radio_button_tag 'csv[columns]', 'all' %> <%= l(:description_all_columns) %></label> | |
84 | </p> |
|
86 | </p> | |
85 | <p> |
|
87 | <p> | |
86 | <label><%= check_box_tag 'csv[description]', '1', @query.has_column?(:description) %> <%= l(:field_description) %></label> |
|
88 | <label><%= check_box_tag 'csv[description]', '1', @query.has_column?(:description) %> <%= l(:field_description) %></label> | |
87 | </p> |
|
89 | </p> | |
88 | <% if @issue_count > Setting.issues_export_limit.to_i %> |
|
90 | <% if @issue_count > Setting.issues_export_limit.to_i %> | |
89 | <p class="icon icon-warning"> |
|
91 | <p class="icon icon-warning"> | |
90 | <%= l(:setting_issues_export_limit) %>: <%= Setting.issues_export_limit.to_i %> |
|
92 | <%= l(:setting_issues_export_limit) %>: <%= Setting.issues_export_limit.to_i %> | |
91 | </p> |
|
93 | </p> | |
92 | <% end %> |
|
94 | <% end %> | |
93 | <p class="buttons"> |
|
95 | <p class="buttons"> | |
94 | <%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %> |
|
96 | <%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %> | |
95 | <%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %> |
|
97 | <%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %> | |
96 | </p> |
|
98 | </p> | |
97 | <% end %> |
|
99 | <% end %> | |
98 | </div> |
|
100 | </div> | |
99 |
|
101 | |||
100 | <% end %> |
|
102 | <% end %> | |
101 | <%= call_hook(:view_issues_index_bottom, { :issues => @issues, :project => @project, :query => @query }) %> |
|
103 | <%= call_hook(:view_issues_index_bottom, { :issues => @issues, :project => @project, :query => @query }) %> | |
102 |
|
104 | |||
103 | <% content_for :sidebar do %> |
|
105 | <% content_for :sidebar do %> | |
104 | <%= render :partial => 'issues/sidebar' %> |
|
106 | <%= render :partial => 'issues/sidebar' %> | |
105 | <% end %> |
|
107 | <% end %> | |
106 |
|
108 | |||
107 | <% content_for :header_tags do %> |
|
109 | <% content_for :header_tags do %> | |
108 | <%= auto_discovery_link_tag(:atom, |
|
110 | <%= auto_discovery_link_tag(:atom, | |
109 | {:query_id => @query, :format => 'atom', |
|
111 | {:query_id => @query, :format => 'atom', | |
110 | :page => nil, :key => User.current.rss_key}, |
|
112 | :page => nil, :key => User.current.rss_key}, | |
111 | :title => l(:label_issue_plural)) %> |
|
113 | :title => l(:label_issue_plural)) %> | |
112 | <%= auto_discovery_link_tag(:atom, |
|
114 | <%= auto_discovery_link_tag(:atom, | |
113 | {:controller => 'journals', :action => 'index', |
|
115 | {:controller => 'journals', :action => 'index', | |
114 | :query_id => @query, :format => 'atom', |
|
116 | :query_id => @query, :format => 'atom', | |
115 | :page => nil, :key => User.current.rss_key}, |
|
117 | :page => nil, :key => User.current.rss_key}, | |
116 | :title => l(:label_changes_details)) %> |
|
118 | :title => l(:label_changes_details)) %> | |
117 | <% end %> |
|
119 | <% end %> | |
118 |
|
120 | |||
119 | <%= context_menu issues_context_menu_path %> |
|
121 | <%= context_menu issues_context_menu_path %> |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
General Comments 0
You need to be logged in to leave comments.
Login now