tramway-export 0.1.2 → 0.1.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99c1c96295830ed89b78703601a271c2f97b86e74a9861b6c1ae195b6b9eb11c
|
4
|
+
data.tar.gz: 7fc5cb109af932fb9f9e58121d1af6dbcd8fef51d554a0c62f47695b89ef7182
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b737162f887a2723004983a7831dbefe50f55b1dbf36d594210d28156e2b9fe6cd8ebd7825342fd0c9bc6570f0b68d4e91f21adced0eb33f4309686b7746d4ea
|
7
|
+
data.tar.gz: 85494e426307467abe02c7e9753d62fd713b346866cfbb17f82962e3fbd18e71cd19206919ae0eb78e9efc797e32a39c4a70b08776ea002a5565b853340ab697
|
data/README.md
CHANGED
@@ -24,20 +24,20 @@ $ bundle
|
|
24
24
|
Tramway::Export.set_exportable_models YourModel, project: :your_project_name
|
25
25
|
```
|
26
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}
|
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
29
|
|
30
|
-
*app/decorators/
|
30
|
+
*app/decorators/your_model_xls_decorator.rb*
|
31
31
|
|
32
32
|
```ruby
|
33
|
-
class
|
33
|
+
class YourModelXlsDecorator < Tramway::Export::Xls::ApplicationDecorator
|
34
34
|
class << self
|
35
35
|
def columns
|
36
36
|
%i[column1 column2 column3] # here array of strings or symbols with columns names. It'll be used as headers in Excel file
|
37
37
|
end
|
38
38
|
|
39
39
|
def filename
|
40
|
-
`your_file_name.
|
40
|
+
`your_file_name.xls`
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -57,6 +57,11 @@ end
|
|
57
57
|
|
58
58
|
#### 5. Restart your server and visit index page of models in your admin panel
|
59
59
|
|
60
|
+
### User instructions
|
61
|
+
|
62
|
+
English coming soon
|
63
|
+
|
64
|
+
[На русском](https://github.com/ulmic/tramway-dev/blob/develop/tramway-export/docs/russian/README.md)
|
60
65
|
|
61
66
|
## Contributing
|
62
67
|
Contribution directions go here.
|
@@ -8,6 +8,7 @@ class Tramway::Export::ExportsController < Tramway::Admin::ApplicationController
|
|
8
8
|
model_class = model_class_name(params[:model])
|
9
9
|
xls_decorator_class = xls_decorator_class_name(params[:model])
|
10
10
|
records = model_class.active.order(id: :desc).send scope
|
11
|
+
records = records.ransack(params[:filter]).result if params[:filter]
|
11
12
|
records = records.send "#{current_user.role}_scope", current_user.id
|
12
13
|
records = xls_decorator_class.decorate records
|
13
14
|
|
@@ -6,5 +6,5 @@
|
|
6
6
|
= fa_icon(:download)
|
7
7
|
.dropdown-menu{ aria: { labelledby: id } }
|
8
8
|
- decorator_class.collections.each do |collection|
|
9
|
-
= link_to collection_human_name(model_name: model_name, collection_name: collection), Tramway::Export::Engine.routes.url_helpers.exports_path(model: model_class, scope: collection), class: 'dropdown-item'
|
9
|
+
= link_to collection_human_name(model_name: model_name, collection_name: collection), Tramway::Export::Engine.routes.url_helpers.exports_path(model: model_class, scope: collection, filter: params[:filter].permit!), class: 'dropdown-item'
|
10
10
|
|
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.3
|
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-02
|
11
|
+
date: 2020-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xls_exporter
|