grape-listing 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/grape/dsl.rb +1 -1
- data/lib/listing_service/spreadsheet.rb +12 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8718471a29bc7aa2abcb3b58465ace6e5dd453962e7f54422fd3e3e311e323c0
|
4
|
+
data.tar.gz: 3d0cc9a56ce90c53464f021944bdfc37f3112d56d009cfe3815ab85e770c4b03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38777a8933a68a07e18b5f47f2ae45a831d6c18d164cdc0e1679c33204964da94446ec95ae83ca10646e52d656d01588f81e9f2e651e8a787c61040fbd4b38f5
|
7
|
+
data.tar.gz: 6c43aca8751cbf6582ab838360c8aed7ed5e239e82dab5ae910e56be71ee8d007fd1aa44729b42e7d5983a44ebf66137c7d2a4b73c749731a68a2913b1e1ff26
|
data/lib/grape/dsl.rb
CHANGED
@@ -53,7 +53,7 @@ module Grape
|
|
53
53
|
end
|
54
54
|
|
55
55
|
header['Access-Control-Expose-Headers'] = 'Content-Disposition'
|
56
|
-
header['Content-Disposition'] = "attachment; filename
|
56
|
+
header['Content-Disposition'] = "attachment; filename*=UTF-8''#{Addressable::URI.escape(filename).force_encoding('utf-8')}"
|
57
57
|
env['api.format'] = :binary
|
58
58
|
end
|
59
59
|
|
@@ -23,7 +23,7 @@ module GrapeListing
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def generate_spreadsheet(objects)
|
26
|
-
filepath = "#{@tempdir}/#{
|
26
|
+
filepath = "#{@tempdir}/#{spreadsheet_filename}"
|
27
27
|
|
28
28
|
# создание таблицы и ее конфигурация
|
29
29
|
workbook = FastExcel.open(filepath, constant_memory: true)
|
@@ -55,6 +55,17 @@ module GrapeListing
|
|
55
55
|
filepath
|
56
56
|
end
|
57
57
|
|
58
|
+
def spreadsheet_filename
|
59
|
+
model_desc =
|
60
|
+
ActiveRecord::Base.connection.execute(
|
61
|
+
"SELECT obj_description('public.#{@model.table_name}'::regclass) as comment"
|
62
|
+
)[0]['comment']&.force_encoding(Encoding::BINARY)
|
63
|
+
|
64
|
+
desc = model_desc.present? ? model_desc.gsub(' ', '_') : @model.table_name
|
65
|
+
|
66
|
+
"#{desc}_#{Time.now.strftime('%Y%m%d_%H%M%S')}.xlsx"
|
67
|
+
end
|
68
|
+
|
58
69
|
def grape_entity_columns
|
59
70
|
@grape_entity.root_exposures.map do |exposure|
|
60
71
|
unless exposure.key == :deleted_at
|