active_scaffold_export 3.6.0 → 3.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b39cbb961c15eaa44301788a0fde3bdd54615acc8547d8c74604a5629f1768d
4
- data.tar.gz: 62806e6733c7562294d7ef265be602e085e3bae56d0a6d4738e4336a21c340dd
3
+ metadata.gz: 248e0924b010eb5822ad05cdb735f486bd848295091e3962d27c5d3717611f97
4
+ data.tar.gz: d19079c8bb42ee90124f5b97440b0c0564fc418b28f23d4d7de8dd47d466a2c2
5
5
  SHA512:
6
- metadata.gz: 864b39ba6cb5855e0437b34dd211fb87e0317cc493c6e887ba7a6e523d1f48040e5e476cbeddf646a84de54846dcf43aa74879354f091d60758cbdd5180da756
7
- data.tar.gz: 67f530f45b91f63eaa04bd31ad88022edf86e709caaf232bb96c57ab1f5f613e746ac08dc42a013b3dce3169a40c37ba78cbdc5062604751790f8abfc0a409f9
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 axlsx_rails and axlsx of course.
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
- This gem has not been tested in other rubies than REE and Ruby 1.9.
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: active_scaffold_config.label) do |sheet|
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? }
@@ -2,7 +2,7 @@ module ActiveScaffoldExport
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 6
5
- PATCH = 0
5
+ PATCH = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
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.0
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-04-16 00:00:00.000000000 Z
13
+ date: 2024-06-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: active_scaffold