Class: ActiveScaffold::Config::Export
- Inherits:
-
Form
- Object
- Form
- ActiveScaffold::Config::Export
- Defined in:
- lib/active_scaffold/config/export.rb
Constant Summary collapse
- @@link =
ActiveScaffold::DataStructures::ActionLink.new('show_export', :label => :export, :type => :collection, :security_method => :export_authorized?)
- @@plugin_directory =
- @@show_form =
true
- @@allow_full_download =
true
- @@force_quotes =
false
- @@default_full_download =
true
- @@default_delimiter =
','
- @@default_skip_header =
false
- @@default_file_format =
Gem::Specification::find_all_by_name('caxlsx').any? ? 'xlsx' : 'csv'
Instance Attribute Summary collapse
-
#allow_full_download ⇒ Object
whether user can ask for full or page export, or default is forced.
-
#default_delimiter ⇒ Object
default column separator for CSV, it can be changed in the form if show_form is enabled.
-
#default_file_format ⇒ Object
default file format to export, it can be changed in the form if show_form is enabled.
-
#default_full_download ⇒ Object
default setting for full export or page export, it can be changed in the form if show_form is enabled.
-
#default_skip_header ⇒ Object
wheter export a header (false) or skip exporting a header (true), it can be changed in the form if show_form is enabled.
-
#force_quotes ⇒ Object
force_quotes option for CSV library.
- #link ⇒ Object
-
#show_form ⇒ Object
whether open a form to allow selecting columns and format settings, or export directly with the defined settings in the controller.
Instance Method Summary collapse
- #default_deselected_columns ⇒ Object
- #default_deselected_columns=(val) ⇒ Object
-
#initialize(core_config) ⇒ Export
constructor
A new instance of Export.
- #multipart? ⇒ Boolean
Constructor Details
#initialize(core_config) ⇒ Export
Returns a new instance of Export.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/active_scaffold/config/export.rb', line 5 def initialize(core_config) super @core = core_config self.show_form = self.class.show_form self.allow_full_download = self.class.allow_full_download self.force_quotes = self.class.force_quotes self.default_full_download = self.class.default_full_download self.default_delimiter = self.class.default_delimiter self.default_skip_header = self.class.default_skip_header self.default_file_format = self.class.default_file_format @formats = [:csv, :xlsx] end |
Instance Attribute Details
#allow_full_download ⇒ Object
whether user can ask for full or page export, or default is forced
76 77 78 |
# File 'lib/active_scaffold/config/export.rb', line 76 def allow_full_download @allow_full_download end |
#default_delimiter ⇒ Object
default column separator for CSV, it can be changed in the form if show_form is enabled
85 86 87 |
# File 'lib/active_scaffold/config/export.rb', line 85 def default_delimiter @default_delimiter end |
#default_file_format ⇒ Object
default file format to export, it can be changed in the form if show_form is enabled
91 92 93 |
# File 'lib/active_scaffold/config/export.rb', line 91 def default_file_format @default_file_format end |
#default_full_download ⇒ Object
default setting for full export or page export, it can be changed in the form if show_form is enabled
82 83 84 |
# File 'lib/active_scaffold/config/export.rb', line 82 def default_full_download @default_full_download end |
#default_skip_header ⇒ Object
wheter export a header (false) or skip exporting a header (true), it can be changed in the form if show_form is enabled
88 89 90 |
# File 'lib/active_scaffold/config/export.rb', line 88 def default_skip_header @default_skip_header end |
#force_quotes ⇒ Object
force_quotes option for CSV library
79 80 81 |
# File 'lib/active_scaffold/config/export.rb', line 79 def force_quotes @force_quotes end |
#link ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/active_scaffold/config/export.rb', line 33 def link @link ||= if show_form self.class.link.clone else ActiveScaffold::DataStructures::ActionLink.new('export', :label => :export, :type => :collection, :inline => false, :security_method => :export_authorized?) end end |
#show_form ⇒ Object
whether open a form to allow selecting columns and format settings, or export directly with the defined settings in the controller
73 74 75 |
# File 'lib/active_scaffold/config/export.rb', line 73 def show_form @show_form end |
Instance Method Details
#default_deselected_columns ⇒ Object
97 98 99 100 |
# File 'lib/active_scaffold/config/export.rb', line 97 def default_deselected_columns self.default_deselected_columns = ActiveScaffold::DataStructures::Set.new if @default_deselected_columns.nil? @default_deselected_columns end |
#default_deselected_columns=(val) ⇒ Object
93 94 95 |
# File 'lib/active_scaffold/config/export.rb', line 93 def default_deselected_columns=(val) @default_deselected_columns = ActiveScaffold::DataStructures::Set.new(*val) end |
#multipart? ⇒ Boolean
104 105 106 |
# File 'lib/active_scaffold/config/export.rb', line 104 def multipart? false end |