summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-10-21 06:19:13 +0000
committerGo MAEDA <maeda@farend.jp>2023-10-21 06:19:13 +0000
commit6a7f2536b5562128f00ce0513d00350137986ad5 (patch)
tree2c6d91f22aecead424bf711e898644582209545e /app/helpers
parenta69b43d5803f578a5dc8d6eda2dfd27f99d9863e (diff)
downloadredmine-6a7f2536b5562128f00ce0513d00350137986ad5.tar.gz
redmine-6a7f2536b5562128f00ce0513d00350137986ad5.zip
Add field separator option to CSV export dialog (#37621).
Patch by Karel Pičman. git-svn-id: https://svn.redmine.org/redmine/trunk@22359 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb17
-rw-r--r--app/helpers/queries_helper.rb2
2 files changed, 18 insertions, 1 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 3177d0eb7..a1d989e25 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1805,6 +1805,23 @@ module ApplicationHelper
end
end
+ def export_csv_separator_select_tag
+ options = [[l(:label_comma_char), ','], [l(:label_semi_colon_char), ';']]
+ # Add the separator from translations if it is missing
+ general_csv_separator = l(:general_csv_separator)
+ unless options.index { |option| option.last == general_csv_separator }
+ options << Array.new(2, general_csv_separator)
+ end
+ content_tag(:p) do
+ concat(
+ content_tag(:label) do
+ concat l(:label_fields_separator) + ' '
+ concat select_tag('field_separator', options_for_select(options, general_csv_separator))
+ end
+ )
+ end
+ end
+
# Returns an array of error messages for bulk edited items (issues, time entries)
def bulk_edit_error_messages(items)
messages = {}
diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb
index 662e22ee8..b90f86457 100644
--- a/app/helpers/queries_helper.rb
+++ b/app/helpers/queries_helper.rb
@@ -323,7 +323,7 @@ module QueriesHelper
def query_to_csv(items, query, options={})
columns = query.columns
- Redmine::Export::CSV.generate(:encoding => params[:encoding]) do |csv|
+ Redmine::Export::CSV.generate(encoding: params[:encoding], field_separator: params[:field_separator]) do |csv|
# csv header fields
csv << columns.map {|c| c.caption.to_s}
# csv lines