Feature #37621 » field_separator_in_csv_export_options.patch
| app/helpers/application_helper.rb (working copy) | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
def export_csv_separator_select_tag
|
||
|
options = [%w(, ,), %w(; ;), %w(: :), %w({tab} {tab}), %w({space} {space})]
|
||
|
# Add the separator from translations if it is missing
|
||
|
general_csv_separator = l(:general_csv_separator)
|
||
|
unless options.index { |option| option.first == 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 = {}
|
||
| app/helpers/queries_helper.rb (working copy) | ||
|---|---|---|
|
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
|
||
| app/views/issues/index.html.erb (working copy) | ||
|---|---|---|
|
</fieldset>
|
||
|
<% end %>
|
||
|
<%= export_csv_encoding_select_tag %>
|
||
|
<%= export_csv_separator_select_tag %>
|
||
|
<% if @issue_count > Setting.issues_export_limit.to_i %>
|
||
|
<p class="icon icon-warning">
|
||
|
<%= l(:setting_issues_export_limit) %>: <%= Setting.issues_export_limit.to_i %>
|
||
| app/views/projects/_list.html.erb (working copy) | ||
|---|---|---|
|
<label><%= radio_button_tag 'c[]', 'all_inline' %> <%= l(:description_all_columns) %></label>
|
||
|
</p>
|
||
|
<%= export_csv_encoding_select_tag %>
|
||
|
<%= export_csv_separator_select_tag %>
|
||
|
<p class="buttons">
|
||
|
<%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);", :data => { :disable_with => false } %>
|
||
|
<%= link_to_function l(:button_cancel), "hideModal(this);" %>
|
||
| app/views/reports/_details.html.erb (working copy) | ||
|---|---|---|
|
<h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
|
||
|
<%= form_tag(project_issues_report_details_path(@project, :detail => params[:detail], :format => 'csv'), :method => :get, :id => 'csv-export-form') do %>
|
||
|
<%= export_csv_encoding_select_tag %>
|
||
|
<%= export_csv_separator_select_tag %>
|
||
|
<p class="buttons">
|
||
|
<%= submit_tag l(:button_export), :name => nil, :onclick => 'hideModal(this);', :data => {:disable_with => false} %>
|
||
|
<%= link_to_function l(:button_cancel), 'hideModal(this);' %>
|
||
| app/views/roles/permissions.html.erb (working copy) | ||
|---|---|---|
|
<h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
|
||
|
<%= form_tag(permissions_roles_path(:format => 'csv'), :method => :get, :id => 'csv-export-form') do %>
|
||
|
<%= export_csv_encoding_select_tag %>
|
||
|
<%= export_csv_separator_select_tag %>
|
||
|
<p class="buttons">
|
||
|
<%= submit_tag l(:button_export), :name => nil, :onclick => 'hideModal(this);', :data => {:disable_with => false} %>
|
||
|
<%= link_to_function l(:button_cancel), 'hideModal(this);' %>
|
||
| app/views/timelog/index.html.erb (working copy) | ||
|---|---|---|
|
</fieldset>
|
||
|
<% end %>
|
||
|
<%= export_csv_encoding_select_tag %>
|
||
|
<%= export_csv_separator_select_tag %>
|
||
|
<p class="buttons">
|
||
|
<%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);", :data => { :disable_with => false } %>
|
||
|
<%= link_to_function l(:button_cancel), "hideModal(this);" %>
|
||
| app/views/timelog/report.html.erb (working copy) | ||
|---|---|---|
|
<div id="csv-export-options" style="display: none;">
|
||
|
<h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
|
||
|
<%= export_csv_encoding_select_tag %>
|
||
|
<%= export_csv_separator_select_tag %>
|
||
|
<p class="buttons">
|
||
|
<%= submit_tag l(:button_export), :name => nil, :id => 'csv-export-button' %>
|
||
|
<%= submit_tag l(:button_cancel), :name => nil, :onclick => 'hideModal(this);', :type => 'button' %>
|
||
| app/views/users/index.html.erb (working copy) | ||
|---|---|---|
|
<div id="csv-export-options" style="display: none;">
|
||
|
<h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
|
||
|
<%= export_csv_encoding_select_tag %>
|
||
|
<%= export_csv_separator_select_tag %>
|
||
|
<p class="buttons">
|
||
|
<%= submit_tag l(:button_export), :name => nil, :id => 'csv-export-button' %>
|
||
|
<%= submit_tag l(:button_cancel), :name => nil, :onclick => 'hideModal(this);', :type => 'button' %>
|
||
| lib/redmine/export/csv.rb (working copy) | ||
|---|---|---|
|
class << self
|
||
|
def generate(options = {}, &block)
|
||
|
col_sep = l(:general_csv_separator)
|
||
|
col_sep = options[:field_separator].present? ? options[:field_separator] : l(:general_csv_separator)
|
||
|
col_sep = case col_sep
|
||
|
when '{tab}'
|
||
|
"\t"
|
||
|
when '{space}'
|
||
|
' '
|
||
|
else
|
||
|
col_sep
|
||
|
end
|
||
|
encoding = Encoding.find(options[:encoding]) rescue Encoding.find(l(:general_csv_encoding))
|
||
|
str =
|
||
| test/helpers/application_helper_test.rb (working copy) | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
def test_export_csv_separator_select_tag
|
||
|
with_locale 'en' do
|
||
|
result = export_csv_separator_select_tag
|
||
|
assert_select_in result,
|
||
|
"option[selected='selected'][value='#{l(:general_csv_separator)}']",
|
||
|
text: l(:general_csv_separator)
|
||
|
end
|
||
|
end
|
||
|
private
|
||
|
def wiki_links_with_special_characters
|
||