tramway-export 0.1.0.1 → 0.1.0.2
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 +46 -9
- data/app/views/tramway/export/_button.html.haml +1 -1
- data/lib/tramway/export/version.rb +1 -1
- data/lib/tramway/export.rb +1 -0
- 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: f81d260bc4a950883e9aa07590b826cd222c640d314bd2126032f95e2a0f2d90
|
4
|
+
data.tar.gz: f24f5e6c3ce21b57026ef7cfb92e700414151b311406bdfe79d78b5a8b6f5df0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '095b3def7d0dff5635ff436b9ae49a2fca7c29846aa3adc944825ba968c83814cf3faca6fd63dddd373d5d6e383dc194ff12a10e4729e68d4705ef12192dfb6e'
|
7
|
+
data.tar.gz: f9a708408a6e9b37d2cb86272b6ecdc088d2f0e3031077384bfd45ed03ea4969cb4e69767272fcde2d621c59ecbc9ad1b5b4fa4575994cfa8a7caddfb13e5fc0
|
data/README.md
CHANGED
@@ -1,26 +1,63 @@
|
|
1
1
|
# Tramway::Export
|
2
|
-
Short description and motivation.
|
3
2
|
|
4
|
-
|
5
|
-
How to use my plugin.
|
3
|
+
Plugin for tramway-admin gem. Provides exporting collections to Excel files.
|
6
4
|
|
7
|
-
## Installation
|
8
|
-
|
5
|
+
## Installation & Usage
|
6
|
+
|
7
|
+
#### 1. Add this line to your application's Gemfile:
|
9
8
|
|
10
9
|
```ruby
|
10
|
+
gem 'tramway-admin'
|
11
11
|
gem 'tramway-export'
|
12
12
|
```
|
13
13
|
|
14
|
-
And then execute:
|
14
|
+
##### 2. And then execute:
|
15
15
|
```bash
|
16
16
|
$ bundle
|
17
17
|
```
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
#### 3. Add exportable models to tramway initializer
|
20
|
+
|
21
|
+
*config/initializers/tramway.rb*
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
Tramway::Export.set_exportable_models YourModel, project: :your_project_name
|
22
25
|
```
|
23
26
|
|
27
|
+
#### 4. Create decorator that describes, how your model should be exported. You need to create exactly decorator name `app/decorators/#{your_model_name}_xlsx_decorator.rb`
|
28
|
+
|
29
|
+
|
30
|
+
*app/decorators/your_model_xlsx_decorator.rb*
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
class YourModelXlsxDecorator < Tramway::Export::Xlsx::ApplicationDecorator
|
34
|
+
class << self
|
35
|
+
def columns
|
36
|
+
%i[column1 column2 column3] # here array of strings or symbols with columns names. It'll be used as headers in Excel file
|
37
|
+
end
|
38
|
+
|
39
|
+
def filename
|
40
|
+
`your_file_name.xlsx`
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def column1
|
45
|
+
# getting value
|
46
|
+
end
|
47
|
+
|
48
|
+
def column2
|
49
|
+
# getting value
|
50
|
+
end
|
51
|
+
|
52
|
+
def column3
|
53
|
+
# getting value
|
54
|
+
end
|
55
|
+
end
|
56
|
+
```
|
57
|
+
|
58
|
+
#### 5. Restart your server and visit index page of models in your admin panel
|
59
|
+
|
60
|
+
|
24
61
|
## Contributing
|
25
62
|
Contribution directions go here.
|
26
63
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
- if Tramway::Export.exportable_model? model_class, project: @application_engine
|
1
|
+
- if Tramway::Export.exportable_model? model_class, project: (@application_engine || @application.name)
|
2
2
|
- model_name = model_class.name.underscore
|
3
3
|
- id = "export-#{model_name}"
|
4
4
|
.btn-group{ role: :group }
|
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.0.
|
4
|
+
version: 0.1.0.2
|
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-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xls_exporter
|