Use block columns to detect exportable columns for hidden fields

This commit is contained in:
Alexander Meindl 2020-05-05 08:06:12 +02:00
parent c4080f5bd2
commit 5986fa05f7
2 changed files with 5 additions and 6 deletions

View File

@ -239,7 +239,7 @@ module AdditionalsQueriesHelper
# columns in ignored_column_names are skipped (names as symbols)
# TODO: this is a temporary fix and should be removed
# after https://www.redmine.org/issues/29830 is in Redmine core.
def query_as_hidden_field_tags(query, ignored_column_names = [])
def query_as_hidden_field_tags(query)
tags = hidden_field_tag('set_filter', '1', id: nil)
if query.filters.present?
@ -253,8 +253,10 @@ module AdditionalsQueriesHelper
else
tags << hidden_field_tag('f[]', '', id: nil)
end
ignored_block_columns = query.block_columns.map(&:name)
query.columns.each do |column|
next if ignored_column_names.present? && ignored_column_names.include?(column.name)
next if ignored_block_columns.include?(column.name)
tags << hidden_field_tag('c[]', column.name, id: nil)
end

View File

@ -2,10 +2,7 @@ div id="#{export_format}-export-options" style="display: none"
h3.title = l(:label_export_options, export_format: export_format.upcase)
= form_tag(url, method: :get, id: "#{export_format}-export-form") do
- ignored_column_names = []
- ignored_column_names << :description if @query.available_filters.key?('description')
- ignored_column_names << :last_notes if @query.available_filters.key?('last_notes')
- query_as_hidden_field_tags @query, ignored_column_names
= query_as_hidden_field_tags @query
p
label
= radio_button_tag 'c[]', '', true