summaryrefslogtreecommitdiffstats
path: root/app/helpers/queries_helper.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-03-12 09:54:40 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-03-12 09:54:40 +0000
commitaeea7f7e23d806c6439d91949ca9e1c147920548 (patch)
tree0c84178cd096abb0ae4ad8c2f75249d0ce821d89 /app/helpers/queries_helper.rb
parentb121335eff9cf73dd127925b1945bef6cc4c5e8f (diff)
downloadredmine-aeea7f7e23d806c6439d91949ca9e1c147920548.tar.gz
redmine-aeea7f7e23d806c6439d91949ca9e1c147920548.zip
Adds query params as hidden field tags to the CSV export form (#22108).
git-svn-id: http://svn.redmine.org/redmine/trunk@15202 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/queries_helper.rb')
-rw-r--r--app/helpers/queries_helper.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb
index 9ad2540e4..6714562ba 100644
--- a/app/helpers/queries_helper.rb
+++ b/app/helpers/queries_helper.rb
@@ -243,4 +243,34 @@ module QueriesHelper
@query
end
end
+
+ # Returns the query definition as hidden field tags
+ def query_as_hidden_field_tags(query)
+ tags = hidden_field_tag("set_filter", "1", :id => nil)
+
+ if query.filters.present?
+ query.filters.each do |field, filter|
+ tags << hidden_field_tag("f[]", field, :id => nil)
+ tags << hidden_field_tag("op[#{field}]", filter[:operator], :id => nil)
+ filter[:values].each do |value|
+ tags << hidden_field_tag("v[#{field}][]", value, :id => nil)
+ end
+ end
+ end
+ if query.column_names.present?
+ query.column_names.each do |name|
+ tags << hidden_field_tag("c[]", name, :id => nil)
+ end
+ end
+ if query.totalable_names.present?
+ query.totalable_names.each do |name|
+ tags << hidden_field_tag("t[]", name, :id => nil)
+ end
+ end
+ if query.group_by.present?
+ tags << hidden_field_tag("group_by", query.group_by, :id => nil)
+ end
+
+ tags
+ end
end