tramway-export 0.1.5.1 → 0.1.6

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: ca1d5e0b55a03d41f70b47106f693e1d40fe8d63a932e6e260f6b5bd885a2189
4
- data.tar.gz: 51c9af0f074f8fbdfd7611852a34954d1d4e3f0dd84c5acd5a0bfc29ea58534b
3
+ metadata.gz: dfe1e49b4ce8fe8999f63e65b2df23f27d95114154fcb6a721d8b8265ed600c9
4
+ data.tar.gz: 7628732a90379fe92c6feb9f336193fa602fa24fe1ba8dc7b36b651697bee39a
5
5
  SHA512:
6
- metadata.gz: d8d7dc48a48d69eaaed4438d86de190461e67c707172438d574cf8a33b490035e6f532fcd53e98c5d2b85604bb5e9ddd9d07395786ad6bb59eb966de364f52ce
7
- data.tar.gz: b72abd00f7100ce4ae019ceaab3d40f65bc15b184bd9ce70dadbef69b4f178dd13bc4faa09cefe83400d108673426978176b1bd554b8fbb53d36178e2d754123
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
- #### 6. Restart your server and visit index page of models in your admin panel
73
+ #### 5. Restart your server and visit index page of models in your admin panel
74
74
 
75
75
  ### User instructions
76
76
 
@@ -6,6 +6,8 @@ class Tramway::Export::ApplicationDecorator
6
6
  end
7
7
 
8
8
  class << self
9
+ include Tramway::Core::Delegating::ClassHelper
10
+
9
11
  def columns
10
12
  []
11
13
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Export
5
- VERSION = '0.1.5.1'
5
+ VERSION = '0.1.6'
6
6
  end
7
7
  end
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.5.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-03-28 00:00:00.000000000 Z
11
+ date: 2020-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xls_exporter