.form-export .well.well-small = I18n.t('basepack.export.no_exported_items', default: [:'admin.export.no_exported_items']) \: %b= export_form.collection.total_count = form_tag form.path, method: 'post', class: 'form-horizontal denser', id: "export_template-form" do = hidden_field_tag "send_data", "all" = form_hash_to_hidden_fields(form.query_form.params) = hidden_field_tag "return_to", params[:return_to] if params[:return_to].present? - if Basepack::Settings.export_template.model_name and can?(:create, Basepack::Settings.export_template.model_name.constantize) = hidden_field_tag 'export_template_name' %fieldset{:id => 'fields_to_export'} %div.control-group %div.controls %label.checkbox{:for => 'check_all'} = 'Vybrat všechny pole' = check_box_tag 'check_all', 'all', false, data: {toggle: "checkboxes", target: "input[name^='schema[]']"} %legend= t('basepack.export.select', default: [:'admin.export.select']) .control-group %label.control-label{"data-toggle" => 'tooltip', title: t('basepack.export.click_to_reverse_selection', default: [:'admin.export.click_to_reverse_selection']), :onclick => 'jQuery(this).siblings(".controls").find("input").click()'}= t('basepack.export.fields_from', default: [:'admin.export.fields_from'], :name => resource_config.label_plural.downcase) .controls - form.visible_fields.select {|f| !f.association? || f.polymorphic? }.each do |field| %label.checkbox{for: "schema_#{field.name}"} = check_box_tag "schema[]", field.name, @schema.include?(field.name.to_s), { id: "schema_#{field.name}" } = field.label - form.visible_fields.select {|f| f.association? && !f.polymorphic? }.each do |field| .control-group %label.control-label{"data-toggle" => 'tooltip', title: t('basepack.export.click_to_reverse_selection', default: [:'admin.export.click_to_reverse_selection']), :onclick => 'jQuery(this).siblings(".controls").find("input").click()'}= t('basepack.export.fields_from_associated', default: [:'admin.export.fields_from_associated'], :name => field.label.downcase) .controls - field.nform.visible_fields.reject {|f| f.association? }.each do |afield| %label.checkbox{:for => "schema_#{field.name}_#{afield.name}"} - field_checked = @schema.find { |f| (Hash === f) and Array.wrap(f[field.name.to_s]).include?(afield.name.to_s) } = check_box_tag "schema[][#{field.name}][]", afield.name, field_checked, { id: "schema_#{field.name}_#{afield.name}" } = afield.label %fieldset %legend= t('basepack.export.options_for', default: [:'admin.export.options_for'], :name => 'csv') .control-group %label.control-label{:for => "csv_options_encoding_to"}= t('basepack.export.csv.encoding_to', default: [:'admin.export.csv.encoding_to']) .controls - encoding_list = Encoding.name_list.sort! - encoding_list = ['UTF-8'] + (encoding_list - ['UTF-8']) if encoding_list.include?('UTF-8') = select_tag 'csv_options[encoding_to]', options_for_select([''] + encoding_list) %p.help-block= t('basepack.export.csv.encoding_to_help', default: [:'admin.export.csv.encoding_to_help'], :name => Basepack::Settings.export.default_encoding_to) .control-group %label.control-label{:for => "csv_options_skip_header"}= t('basepack.export.csv.skip_header', default: [:'admin.export.csv.skip_header']) .controls = check_box_tag 'csv_options[skip_header]', 'true' %p.help-block= t('basepack.export.csv.skip_header_help', default: [:'admin.export.csv.skip_header_help']) .control-group %label.control-label{:for => "csv_options_col_sep"}= t('basepack.export.csv.col_sep.label', default: [:'admin.export.csv.col_sep']) .controls = select_tag 'csv_options[col_sep]', options_for_select({'' => Basepack::Settings.export.default_col_sep, t('basepack.export.csv.col_sep.comma') => ',', t('basepack.export.csv.col_sep.semicolon') => ';', t('basepack.export.csv.col_sep.tab') => "'\t'" }) %p.help-block= t('basepack.export.csv.col_sep_help', default: [:'admin.export.csv.col_sep_help'], :value => Basepack::Settings.export.default_col_sep) .form-actions .pull-right - if Basepack::Settings.export_template.model_name and can?(:create, Basepack::Settings.export_template.model_name.constantize) = button_tag class: 'btn', id: 'export_template-add', title: I18n.t('basepack.export.save_export_template') do %i.icon-plus =I18n.t('basepack.export.save_export_template') :javascript jQuery(function($) { $("#export_template-add").click(function(e) { e.preventDefault(); bootbox.prompt(#{I18n.t('basepack.export.enter_export_template_name').to_json}, function(result) { if (result) { $('#export_template-form input[name=export_template_name]').val(result); $('#export_template-form').submit(); } }); }); }); %button.btn.btn-primary{:type => "submit", :name => 'csv'} %i.icon-white.icon-ok = t("basepack.export.confirmation", default: :"admin.export.confirmation", :name => 'csv') %button.btn.btn-info{:type => "submit", :name => 'json'} = t("basepack.export.confirmation", default: :"admin.export.confirmation", :name => 'json') %button.btn.btn-info{:type => "submit", :name => 'xml'} = t("basepack.export.confirmation", default: :"admin.export.confirmation", :name => 'xml')