active_scaffold_export 3.6.0 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -2
- data/lib/active_scaffold/actions/export.rb +7 -1
- data/lib/active_scaffold_export/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 248e0924b010eb5822ad05cdb735f486bd848295091e3962d27c5d3717611f97
|
4
|
+
data.tar.gz: d19079c8bb42ee90124f5b97440b0c0564fc418b28f23d4d7de8dd47d466a2c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 882365bcd892ca7bdbda4a0638b30baca1a7e7c08220dbf53ab1751976d0904149dd1da50431210e09b9eaf9ad8a62999abd03f28f95660121ec6d054da66767
|
7
|
+
data.tar.gz: 2aeb345b8beff579c6ca03b5b2fc1a595c17ab471ac8de73ff4c492cd97c7782f41952369795ea0406af3d217b6776a9b0e6569b4868eae04b206a9219b9786f
|
data/README.md
CHANGED
@@ -58,13 +58,20 @@ active_scaffold:
|
|
58
58
|
```
|
59
59
|
|
60
60
|
### XLSX support
|
61
|
-
This support depends on
|
61
|
+
This support depends on caxlsx_rails and caxlsx of course.
|
62
62
|
header styling override will be added soon.
|
63
63
|
NOTE: There's NO streaming support for xlsx format. Only CSV. So if your data is huge, set default_file_format to 'csv' instead.
|
64
64
|
Streaming in xlsx will never be supported since the entire file needs to be serialized and zipped to be a valid OOXML file.
|
65
65
|
So, rather than streaming, background jobs will be the most likely future approach.
|
66
66
|
[Read axlsx issue about this](https://github.com/randym/axlsx/issues/169#issuecomment-13252750)
|
67
67
|
|
68
|
-
|
68
|
+
The sheet name is generated from conf.label, replacing forbidden chars with '-' and truncated to 31. The generated name can be changed defining workseet_name method in the controller, and calling super with options for truncate String method, and :replace option to use other character, e.g.
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
def worksheet_name(options = {})
|
72
|
+
super replace: '_', omission: ''
|
73
|
+
end
|
74
|
+
```
|
75
|
+
|
69
76
|
For contact, help, support, comments, please use Active Scaffold official mailing list activescaffold@googlegroups.com
|
70
77
|
|
@@ -75,7 +75,7 @@ module ActiveScaffold::Actions
|
|
75
75
|
response.headers['Content-type'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
76
76
|
pkg = Axlsx::Package.new
|
77
77
|
header = pkg.workbook.styles.add_style sz: 11, b: true,:bg_color => "69B5EF", :fg_color => "FF", alignment: { horizontal: :center }
|
78
|
-
pkg.workbook.add_worksheet(name:
|
78
|
+
pkg.workbook.add_worksheet(name: worksheet_name) do |sheet|
|
79
79
|
sheet.add_row(@export_columns.collect { |column| view_context.format_export_column_header_name(column) }, style: header) unless params[:skip_header]
|
80
80
|
find_items_for_export do |records|
|
81
81
|
records.each do |record|
|
@@ -89,6 +89,12 @@ module ActiveScaffold::Actions
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
+
def worksheet_name(options = {})
|
93
|
+
active_scaffold_config.label.
|
94
|
+
gsub(/[#{Regexp.quote Axlsx::WORKSHEET_NAME_FORBIDDEN_CHARS.join}]/, options[:replace] || '-').
|
95
|
+
truncate(Axlsx::WORKSHEET_MAX_NAME_LENGTH, options)
|
96
|
+
end
|
97
|
+
|
92
98
|
def export_columns
|
93
99
|
return @export_columns if defined? @export_columns
|
94
100
|
@export_columns = active_scaffold_config.export.columns.reject { |col| params[:export_columns][col.to_sym].nil? }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_scaffold_export
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.
|
4
|
+
version: 3.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Volker Hochstein
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-06-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: active_scaffold
|