grape-listing 1.1.6 → 1.1.8
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/search.rb +2 -2
- data/lib/listing_service/spreadsheet.rb +12 -1
- 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: b47ec8a91643cdf3b1ab90b6f2f6f3ede8ee0c0ab069b9f79b9b5c3bca7339d7
|
4
|
+
data.tar.gz: 0d69408736e14c1839167cb33ec0ee8e6b335046f5989b041668c6497c0d205a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 541f2e90aa6ec5f9c6778259da1d58037ece13a5e7238765ac0641c9aac2ac7eaa8bb2c60fb9f44a4b04854220f4bdaed32ed569f8a2b5a82a6669a67df154ea
|
7
|
+
data.tar.gz: 18599c3bfbedf62aa12d653b8cb052d67d5646998a1cf9a02c15bbc91b21332878a832b004809e4dc53ce2301463613792fcd17abad857cd3b60e95e71b7e90c
|
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
|
|
@@ -25,7 +25,7 @@ module GrapeListing
|
|
25
25
|
end
|
26
26
|
|
27
27
|
# форматирование кавычек
|
28
|
-
if operator != 'IN'
|
28
|
+
if operator != 'IN'
|
29
29
|
value = quotations_formatting(value)
|
30
30
|
end
|
31
31
|
|
@@ -57,7 +57,7 @@ module GrapeListing
|
|
57
57
|
# проверка мульти-поиска по параметру с массивом
|
58
58
|
if operator == 'multi' && !value.blank?
|
59
59
|
operator = 'IN'
|
60
|
-
value = "(#{value.join(', ')})"
|
60
|
+
value = "(#{value.map { |i| "'#{i}'" }.join(', ')})"
|
61
61
|
end
|
62
62
|
|
63
63
|
# проверка диапазона (MIN/MAX)
|
@@ -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
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-listing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Павел Бабин
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|