tramway-export 0.1.5.1 → 0.1.6
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 +4 -4
- data/app/decorators/tramway/export/application_decorator.rb +2 -0
- data/lib/tramway/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: dfe1e49b4ce8fe8999f63e65b2df23f27d95114154fcb6a721d8b8265ed600c9
|
4
|
+
data.tar.gz: 7628732a90379fe92c6feb9f336193fa602fa24fe1ba8dc7b36b651697bee39a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8836b61442daa759964dc780e8742a8d796ca0abe8008c763ab9db82f235732123397cc9e501ab633aa376991dc2adaa171d32dd3ea1c06143e85e9726aae44e
|
7
|
+
data.tar.gz: 292c36eb4d60c0024993d96a5d7cf3dcfae1bb2eba04a6e88f34ae16d66a2ecf1439af8ebbf922dcd080f4ff9d2c53d2b6ff38faac1facb6c0321e7fac911ae3
|
data/README.md
CHANGED
@@ -26,6 +26,7 @@ Tramway::Export.set_exportable_models YourModel, project: :your_project_name
|
|
26
26
|
|
27
27
|
#### 4. Create decorator that describes, how your model should be exported. You need to create exactly decorator name `app/decorators/#{your_model_name}_xls_decorator.rb`
|
28
28
|
|
29
|
+
**If you have constant list of columns just use `columns` method this way**
|
29
30
|
|
30
31
|
*app/decorators/your_model_xls_decorator.rb*
|
31
32
|
|
@@ -54,8 +55,7 @@ class YourModelXlsDecorator < Tramway::Export::Xls::ApplicationDecorator
|
|
54
55
|
end
|
55
56
|
end
|
56
57
|
```
|
57
|
-
|
58
|
-
#### 5. You can set flexible columns for each record. Just use `flexible_columns` method in object area
|
58
|
+
**If you don't have constant list of columns, use `flexible_columns` this way**
|
59
59
|
|
60
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
61
|
|
@@ -64,13 +64,13 @@ Just imagine: our model contains method `values` and we want to have columns acc
|
|
64
64
|
class YourModelXlsDecorator < Tramway::Export::Xls::ApplicationDecorator
|
65
65
|
def flexible_columns
|
66
66
|
object.values.keys.map do |key|
|
67
|
-
{ key.to_sym => -> { values.dig(key) } }
|
67
|
+
{ key.to_sym => -> { object.values.dig(key) } }
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
71
71
|
```
|
72
72
|
|
73
|
-
####
|
73
|
+
#### 5. Restart your server and visit index page of models in your admin panel
|
74
74
|
|
75
75
|
### User instructions
|
76
76
|
|
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.6
|
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-
|
11
|
+
date: 2020-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xls_exporter
|