tramway-export 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -1
- data/app/controllers/tramway/export/exports_controller.rb +2 -0
- data/lib/tramway/export/version.rb +1 -1
- data/lib/tramway/export.rb +1 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecc59e6b00eec57ba2ef824370f701dd3cb5fe60fb963e86898f955c9c229b9d
|
4
|
+
data.tar.gz: 0d104b8a1e7f833b139341d8de591e58d301119162428a5c5b377fba8e80dd08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3372a266fc875feb286b7cbec715d3dc9af4461dbe218d055566921598411160f87f211f003be82d924e9b496f2ef5afdee67ef177bd53a0b19f5f878286f97
|
7
|
+
data.tar.gz: ed404df571acff6bb5ed52f031154d6e173634fbe4ffd5881482150e7260dd2142b725936f738d7d369c747048d584969146ba3de451af5fd32e9a1b567b3875
|
data/README.md
CHANGED
@@ -55,7 +55,22 @@ class YourModelXlsDecorator < Tramway::Export::Xls::ApplicationDecorator
|
|
55
55
|
end
|
56
56
|
```
|
57
57
|
|
58
|
-
#### 5.
|
58
|
+
#### 5. You can set flexible columns for each record. Just use `flexible_columns` method in object area
|
59
|
+
|
60
|
+
Just imagine: our model contains method `values` and we want to have columns according to `values` keys. You shouldn't create methods for every column. Just use `Proc`. It's provided by gem `xls_exporter`. You can read more about [here](https://github.com/kalashnikovisme/xls-exporter).
|
61
|
+
|
62
|
+
*app/decorators/your_model_xls_decorator.rb*
|
63
|
+
```ruby
|
64
|
+
class YourModelXlsDecorator < Tramway::Export::Xls::ApplicationDecorator
|
65
|
+
def flexible_columns
|
66
|
+
object.values.keys.map do |key|
|
67
|
+
{ key.to_sym => -> { values.dig(key) } }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
```
|
72
|
+
|
73
|
+
#### 6. Restart your server and visit index page of models in your admin panel
|
59
74
|
|
60
75
|
### User instructions
|
61
76
|
|
@@ -17,6 +17,8 @@ class Tramway::Export::ExportsController < Tramway::Admin::ApplicationController
|
|
17
17
|
end
|
18
18
|
|
19
19
|
book = ::XlsExporter.export do
|
20
|
+
default_style horizontal_align: :center, vertical_align: :center, text_wrap: true
|
21
|
+
|
20
22
|
add_sheet 'List'
|
21
23
|
|
22
24
|
export_models records, *columns
|
data/lib/tramway/export.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-export
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xls_exporter
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1.2'
|
27
27
|
description: Rails engine for exporting data
|
28
28
|
email:
|
29
29
|
- kalashnikovisme@gmail.com
|
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
|
-
rubygems_version: 3.
|
72
|
+
rubygems_version: 3.1.2
|
73
73
|
signing_key:
|
74
74
|
specification_version: 4
|
75
75
|
summary: Rails engine for exporting data
|