- params = request.params.except(:action, :controller, :utf8, :page, :per_page, :format, :authenticity_token) - visible_fields = @model_config.export.with(:view => self, :object => @abstract_model.model.new).visible_fields = form_tag export_path(params.merge(:all => true)), :method => 'post', :class => 'form-stacked' do %input{:name => "send_data", :type => "hidden", :value => "true"}/ .row %fieldset %legend= t('admin.export.select') .span5.clearfix %label{:rel => 'twipsy', :'data-original-title' => t('admin.export.click_to_reverse_selection'), :onclick => 'jQuery(this).siblings(".input").find("input").click()'}= t('admin.export.fields_from', :name => @abstract_model.pretty_name) .input %ul.inputs-list - visible_fields.select{ |f| !f.association? || f.association[:polymorphic] }.each do |field| %li - list = field.virtual? ? 'methods' : 'only' - if field.association? && field.association[:polymorphic] %label{:for => "schema_#{list}_#{field.method_name}"} = check_box_tag "schema[#{list}][]", field.method_name, true, { :id => "schema_#{list}_#{field.method_name}" } %strong= @abstract_model.model.human_attribute_name(field.method_name) - polymorphic_type_column_name = @abstract_model.properties.find {|p| field.association[:foreign_type] == p[:name] }[:name] %label{:for => "schema_#{list}_#{polymorphic_type_column_name}"} = check_box_tag "schema[#{list}][]", polymorphic_type_column_name, true, { :id => "schema_#{list}_#{polymorphic_type_column_name}" } %strong= @abstract_model.model.human_attribute_name(polymorphic_type_column_name) - else %label{:for => "schema_#{list}_#{field.name}"} = check_box_tag "schema[#{list}][]", field.name, true, { :id => "schema_#{list}_#{field.name}" } %strong= @abstract_model.model.human_attribute_name(field.name) - visible_fields.select{ |f| f.association? && !f.association[:polymorphic] }.each do |field| .span5.clearfix - association = field.association - associated_model = association[:type] == :belongs_to ? association[:parent_model] : association[:child_model] - fields = RailsAdmin.config(associated_model).export.with(:view => self, :object => associated_model.new).visible_fields.select{ |f| !f.association? } %label{:rel => 'twipsy', :'data-original-title' => t('admin.export.click_to_reverse_selection'), :onclick => 'jQuery(this).siblings(".input").find("input").click()'}= t('admin.export.fields_from_associated', :name => field.label) .input %ul.inputs-list - fields.each do |associated_model_field| - list = associated_model_field.type != 'virtual' ? 'only' : 'methods' %li %label{:for => "schema_include_#{association[:name]}_#{list}_#{associated_model_field.name}"} = check_box_tag "schema[include][#{association[:name]}][#{list}][]", associated_model_field.name, true, { :id => "schema_include_#{association[:name]}_#{list}_#{associated_model_field.name}" } %strong= associated_model.human_attribute_name(associated_model_field.name) .row %fieldset %legend= t('admin.export.options_for', :name => 'csv') - guessed_encoding = (Rails.configuration.database_configuration[Rails.env]['encoding'].presence rescue 'UTF-8') || 'UTF-8' .clearfix %label{:for => "csv_options_encoding_to"}= t('admin.export.csv.encoding_to') -# from http://books.google.com/support/partner/bin/answer.py?answer=30990 : = select_tag 'csv_options[encoding_to]', options_for_select(["", "UTF-8", "UTF-16LE", "UTF-16BE", "UTF-32LE", "UTF-32BE", "UTF-7", "ISO-8859-1", "ISO-8859-15", "IBM-850", "MacRoman", "Windows-1252", "ISO-8859-3", "IBM-852", "ISO-8859-2", "MacCE", "Windows-1250", "IBM-855", "ISO-8859-5", "ISO-IR-111", "KOI8-R", "MacCyrillic", "Windows-1251", "CP-866", "KOI-U", "MacUkranian", "GB2312", "GBK", "GB18030", "HZ", "ISO-2022-CN", "Big5", "Big5-HKSCS", "EUC-TW", "EUC-JP", "ISO-2022-JP", "Shift_JIS", "EUC-KR", "UHC", "JOHAB", "ISO-2022-KR"]) %span.help-inline= t('admin.export.csv.encoding_to_help', :name => guessed_encoding) .clearfix %label{:for => "csv_options_skip_header"}= t('admin.export.csv.skip_header') = check_box_tag 'csv_options[skip_header]', 'true' %span.help-inline= t('admin.export.csv.skip_header_help') .clearfix %label{:for => "csv_options_generator_col_sep"}= t('admin.export.csv.col_sep') = select_tag 'csv_options[generator][col_sep]', options_for_select({ '' => t('admin.export.csv.default_col_sep'), " ','" => ',', " ';'" => ';', '' => "'\t'" }) %span.help-inline= t('admin.export.csv.col_sep_help', :value => t('admin.export.csv.default_col_sep')) .actions %button.btn.primary{:type => "submit", :name => 'csv'} = t("admin.export.confirmation", :name => 'csv') %button.btn.info{:type => "submit", :name => 'json'} = t("admin.export.confirmation", :name => 'json') %button.btn.info{:type => "submit", :name => 'xml'} = t("admin.export.confirmation", :name => 'xml') %button.btn{:type => "submit", :name => "_continue"} = t("admin.new.cancel")