tramway-export 0.1.3 → 0.1.4
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: af9b78d49eec7bcdbcf6b11f6c173748d889c209dee386ec33f318b643436fa8
|
4
|
+
data.tar.gz: 3c1546aed1ee45a57546ecc5f32a2161c306fdf580227ade54425f3afd895957
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 633a6472e18d8142213e8c4cbe64dc8959a05cf8ac1ef38ac2853df4d200cc651f33feaf24b3625e3ba9dfdbda7a114840ed67697ad9f4a769caf030192ee46b
|
7
|
+
data.tar.gz: 9cc083bf8bf268bb4512b4ea103624ca52b55eb2321fa329b3ef2bf358ae9e46da63ecf6e742179744a495c6be4606e458caa98f8dbfa4ed339c057f08892a9c
|
@@ -8,14 +8,18 @@ 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
|
+
records = records.ransack(params[:filter]).result if params[:filter].present?
|
12
12
|
records = records.send "#{current_user.role}_scope", current_user.id
|
13
13
|
records = xls_decorator_class.decorate records
|
14
14
|
|
15
|
+
columns = xls_decorator_class.columns + records.map(&:flexible_columns).flatten.uniq do |hash|
|
16
|
+
hash&.keys&.first
|
17
|
+
end
|
18
|
+
|
15
19
|
book = ::XlsExporter.export do
|
16
20
|
add_sheet 'List'
|
17
21
|
|
18
|
-
export_models records, *
|
22
|
+
export_models records, *columns
|
19
23
|
end
|
20
24
|
stream = StringIO.new
|
21
25
|
book.write stream
|
@@ -6,5 +6,4 @@
|
|
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, filter: params[:filter]
|
10
|
-
|
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'
|
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.4
|
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-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xls_exporter
|