activeadmin-exporter 0.0.2 → 0.0.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '0419a7f8744f2fdf47941b1f1536d51f54a2e48f6f92f9f7978e430f60d66b7a'
|
4
|
+
data.tar.gz: 9702118cd4a63d45e120fb96159f911d3b962988c06cd4d7d4d5214fb8fe8b72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d47a8a43bf235000b540e0b06b49d0e2195fcc0a5987126ec603b73811a6901674f45b9c12090b19bc027ce8196c49d3cbc8b062039682fda499cd55a1e2246b
|
7
|
+
data.tar.gz: 27f460d1c1e7bf1ef83709f04e48651b5f2461126866003ed87cf424ebb10507f8db29b331dfa6f1ec16b4d8b3231468b2b2ec98e2b2bbc5f205aaf7b3f49e08
|
@@ -6,9 +6,9 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.version = ActiveAdmin::Exporter::VERSION
|
7
7
|
gem.authors = ['Nikita Anistratenko']
|
8
8
|
gem.email = ['steverovsky@gmail.com']
|
9
|
-
gem.description = %q
|
9
|
+
gem.description = %q(ActiveAdmin plugin for expanding export possibilities.)
|
10
10
|
gem.summary = %q{Allows to asynchronously pack export result in ZIP and send it to email.}
|
11
|
-
gem.homepage =
|
11
|
+
gem.homepage = 'https://github.com/steverovsky/activeadmin-exporter'
|
12
12
|
|
13
13
|
gem.files = `git ls-files`.split("\n")
|
14
14
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -1,23 +1,29 @@
|
|
1
1
|
module ActiveAdmin
|
2
2
|
module Exporter
|
3
3
|
class ExporterMailer < ActionMailer::Base
|
4
|
+
DEFAULT_TEMPLATE_PATH = '/admin_mailer'.freeze
|
5
|
+
DEFAULT_TEMPLATE_NAME = 'message_export'.freeze
|
6
|
+
|
7
|
+
layout 'mailer'
|
8
|
+
|
4
9
|
def csv_export(recipient_email, class_name, params_json)
|
5
10
|
params = JSON.parse(params_json)
|
6
11
|
controller = class_name.constantize.new
|
7
|
-
controller.send('params=', params)
|
12
|
+
controller.send('params=', params.merge(email: recipient_email))
|
8
13
|
|
9
14
|
config = controller.send(:active_admin_config)
|
10
15
|
csv_filename = controller.send(:csv_filename)
|
16
|
+
entity_name = controller.send(:resource_collection_name)
|
11
17
|
zip_filename = csv_filename.sub('.csv', '.zip')
|
12
18
|
|
13
19
|
def controller.find_collection(options = {})
|
14
|
-
options[:only] = [
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
20
|
+
options[:only] = %i[
|
21
|
+
sorting
|
22
|
+
filtering
|
23
|
+
scoping
|
24
|
+
includes
|
25
|
+
pagination
|
26
|
+
collection_decorator
|
21
27
|
]
|
22
28
|
|
23
29
|
collection = scoped_collection
|
@@ -33,12 +39,19 @@ module ActiveAdmin
|
|
33
39
|
end
|
34
40
|
|
35
41
|
attachments[zip_filename] = zip.string
|
42
|
+
subject = I18n.t(
|
43
|
+
'message.active_admin_export_subject',
|
44
|
+
entity_name: entity_name.to_s.humanize,
|
45
|
+
default: zip_filename
|
46
|
+
)
|
36
47
|
|
37
48
|
mail(
|
49
|
+
layout: 'mailer',
|
38
50
|
to: recipient_email,
|
39
|
-
subject:
|
40
|
-
|
41
|
-
|
51
|
+
subject: subject,
|
52
|
+
from: ActiveAdmin::Exporter.from_email_address,
|
53
|
+
template_path: DEFAULT_TEMPLATE_PATH,
|
54
|
+
template_name: DEFAULT_TEMPLATE_NAME
|
42
55
|
)
|
43
56
|
end
|
44
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin-exporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikita Anistratenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeadmin
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
92
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.
|
93
|
+
rubygems_version: 2.7.7
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: Allows to asynchronously pack export result in ZIP and send it to email.
|